summaryrefslogtreecommitdiff
path: root/matrix-lang/src/vm.rs
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-02-29 21:05:10 -0500
committerFreya Murphy <freya@freyacat.org>2024-02-29 21:05:10 -0500
commitace046624d2e23fba67564a86af7f03ed8a48eae (patch)
tree21ae64bc5897b1b89ee2ab8563b0e7ce047bf34a /matrix-lang/src/vm.rs
parentfix readme (diff)
downloadmatrix-ace046624d2e23fba67564a86af7f03ed8a48eae.tar.gz
matrix-ace046624d2e23fba67564a86af7f03ed8a48eae.tar.bz2
matrix-ace046624d2e23fba67564a86af7f03ed8a48eae.zip
remove unwraps, fix utf8
Diffstat (limited to 'matrix-lang/src/vm.rs')
-rw-r--r--matrix-lang/src/vm.rs4
1 files changed, 2 insertions, 2 deletions
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"))?;
},
};