From 54e0cc7f13db8150b7549286a38b07c835649224 Mon Sep 17 00:00:00 2001 From: Robsdedude Date: Fri, 7 Nov 2025 15:01:32 +0100 Subject: [PATCH] Minor improvement of internal error message This error path shouldn't ever be hit if the driver is working as intended. This change might make debugging while developing the driver slightly easier in the future. Initial discussion: https://github.com/neo4j/neo4j-python-driver-rust-ext/pull/70#discussion_r2503626096 --- changelog.d/74.dev.md | 1 + src/vector.rs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 changelog.d/74.dev.md diff --git a/changelog.d/74.dev.md b/changelog.d/74.dev.md new file mode 100644 index 0000000..1488035 --- /dev/null +++ b/changelog.d/74.dev.md @@ -0,0 +1 @@ +Improve details of internal error message. diff --git a/src/vector.rs b/src/vector.rs index d86a7b0..d3e548b 100644 --- a/src/vector.rs +++ b/src/vector.rs @@ -38,9 +38,9 @@ fn swap_endian<'py>( let bytes = &data.as_bytes(); let len = bytes.len(); if len % type_size != 0 { - return Err(PyErr::new::( - "Data length not a multiple of type_size", - )); + return Err(PyErr::new::(format!( + "Data length {len} not a multiple of type_size {type_size}", + ))); } PyBytes::new_with(py, bytes.len(), |out| {