From ace046624d2e23fba67564a86af7f03ed8a48eae Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Thu, 29 Feb 2024 21:05:10 -0500 Subject: remove unwraps, fix utf8 --- matrix-lang/src/vm.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'matrix-lang/src/vm.rs') diff --git a/matrix-lang/src/vm.rs b/matrix-lang/src/vm.rs index bac6341..b8da01f 100644 --- a/matrix-lang/src/vm.rs +++ b/matrix-lang/src/vm.rs @@ -217,7 +217,7 @@ impl Vm { let val = self.globals .borrow_mut() .get(&idx) - .unwrap() + .ok_or(exception!(RUNTIME_EXCEPTION, "undefined global at index {idx}"))? .clone(); self.stack.push(val); }, @@ -380,7 +380,7 @@ impl Vm { self.trystack.push(scope); }, I::TryEnd => { - self.trystack.pop().unwrap(); + self.trystack.pop().ok_or(exception!(RUNTIME_EXCEPTION, "try stack smashed"))?; }, }; -- cgit v1.2.3-freya