diff options
| author | Edvard Thörnros <edvard.thornros@gmail.com> | 2021-02-17 22:20:17 +0100 |
|---|---|---|
| committer | Edvard Thörnros <edvard.thornros@gmail.com> | 2021-02-19 18:02:44 +0100 |
| commit | 54f82c4f415be770063a3315ebbb66e5b61c46a1 (patch) | |
| tree | a066ce36fe407b4632be5d598635c5ef10a0a1c2 /src/error.rs | |
| parent | eca549af7e048ecddd61fcedd4202b1fe8948b1d (diff) | |
| download | sylt-54f82c4f415be770063a3315ebbb66e5b61c46a1.tar.gz | |
change errors in vm
Diffstat (limited to 'src/error.rs')
| -rw-r--r-- | src/error.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/error.rs b/src/error.rs index 4e2209e..337acab 100644 --- a/src/error.rs +++ b/src/error.rs @@ -12,14 +12,20 @@ use crate::tokenizer::Token; #[derive(Debug, Clone)] pub enum ErrorKind { TypeError(Op, Vec<Type>), + TypeMismatch(Type, Type), + CannotInfer(Type, Type), + ArgumentType(Vec<Type>, Vec<Type>), + IndexError(Value, Type), + /// (External function, parameters) ExternTypeMismatch(String, Vec<Type>), ValueError(Op, Vec<Value>), + UnkownField(Value, String), + ArgumentCount(usize, usize), /// (Indexed value, length, index) IndexOutOfBounds(Value, usize, usize), - /// Sanity checking errors AssertFailed, InvalidProgram, Unreachable, @@ -69,6 +75,9 @@ impl fmt::Display for ErrorKind { ErrorKind::InvalidProgram => { write!(f, "{}", "[!!] Invalid program [!!]".bold()) } + _ => { + write!(f, "{}", "[!!] UNHANDLED ERROR") + } } } } |
