Skip to content

Commit 54e0cc7

Browse files
committed
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: #70 (comment)
1 parent 0d69ed8 commit 54e0cc7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

changelog.d/74.dev.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improve details of internal error message<ISSUES_LIST>.

src/vector.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ fn swap_endian<'py>(
3838
let bytes = &data.as_bytes();
3939
let len = bytes.len();
4040
if len % type_size != 0 {
41-
return Err(PyErr::new::<PyValueError, _>(
42-
"Data length not a multiple of type_size",
43-
));
41+
return Err(PyErr::new::<PyValueError, _>(format!(
42+
"Data length {len} not a multiple of type_size {type_size}",
43+
)));
4444
}
4545

4646
PyBytes::new_with(py, bytes.len(), |out| {

0 commit comments

Comments
 (0)