From 5ccc02213d6a8ae6d0c86f85b6c7e2a323a96973 Mon Sep 17 00:00:00 2001 From: n4n5 Date: Wed, 29 May 2024 10:13:45 +0200 Subject: [PATCH] add error handling --- asn-compiler/src/resolver/asn/values.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/asn-compiler/src/resolver/asn/values.rs b/asn-compiler/src/resolver/asn/values.rs index 576451b..a2ce17f 100644 --- a/asn-compiler/src/resolver/asn/values.rs +++ b/asn-compiler/src/resolver/asn/values.rs @@ -25,7 +25,16 @@ pub(crate) fn resolve_value( match typeref { Asn1ResolvedType::Base(ref b) => match b { ResolvedBaseType::Integer(ref _i) => { - let value = value.parse::().unwrap(); + let value = match value.parse::() { + Ok(v) => v, + Err(e) => { + return Err(resolve_error!( + "resolve_value: Failed to parse Integer value: {} from {:?}", + e, + value + )) + } + }; Ok(Asn1ResolvedValue::Base(ResolvedBaseValue::Integer( Asn1ResolvedIntegerValue { typeref: typeref.clone(),