Skip to content

Commit 2b3b5fb

Browse files
committed
fix pystruct to use struct.error
Signed-off-by: snowapril <sinjihng@gmail.com>
1 parent 2b0c16d commit 2b3b5fb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

vm/src/stdlib/pystruct.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,9 @@ pub(crate) mod _struct {
460460
T: PrimInt + for<'a> std::convert::TryFrom<&'a BigInt>,
461461
{
462462
match vm.to_index_opt(arg) {
463-
Some(index) => index?.try_to_primitive(vm),
463+
Some(index) => index?
464+
.try_to_primitive(vm)
465+
.map_err(|_| new_struct_error(vm, "argument out of range".to_owned())),
464466
None => Err(new_struct_error(
465467
vm,
466468
"required argument is not an integer".to_owned(),

0 commit comments

Comments
 (0)