about summary refs log tree commit diff
path: root/src/interpreter/error.rs
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2021-03-07T20·29-0500
committerGriffin Smith <root@gws.fyi>2021-03-07T20·29-0500
commit80f8ede0bbc9799d5199707e1e1ad8e80e4ca7ac (patch)
treecbb418b042583714fe09f946f1b9a03d1d98857f /src/interpreter/error.rs
Initial commit
Diffstat (limited to 'src/interpreter/error.rs')
-rw-r--r--src/interpreter/error.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/interpreter/error.rs b/src/interpreter/error.rs
new file mode 100644
index 000000000000..e0299d180553
--- /dev/null
+++ b/src/interpreter/error.rs
@@ -0,0 +1,16 @@
+use std::result;
+
+use thiserror::Error;
+
+use crate::ast::{Ident, Type};
+
+#[derive(Debug, PartialEq, Eq, Error)]
+pub enum Error {
+    #[error("Undefined variable {0}")]
+    UndefinedVariable(Ident<'static>),
+
+    #[error("Unexpected type {actual}, expected type {expected}")]
+    InvalidType { actual: Type, expected: Type },
+}
+
+pub type Result<T> = result::Result<T, Error>;