diff options
| author | Edvard Thörnros <edvard.thornros@gmail.com> | 2021-01-30 22:34:19 +0100 |
|---|---|---|
| committer | Edvard Thörnros <edvard.thornros@gmail.com> | 2021-01-30 22:34:19 +0100 |
| commit | 4253c1c20013ab16564aa3ec34585dd1a358d182 (patch) | |
| tree | f1d96d0aa8c4af949b1284129d6366d697139bb0 /src/error.rs | |
| parent | 1a82b85817646aded501051f4e9d651f7c0d4970 (diff) | |
| download | sylt-4253c1c20013ab16564aa3ec34585dd1a358d182.tar.gz | |
add in tuples
Diffstat (limited to 'src/error.rs')
| -rw-r--r-- | src/error.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs index 2caced9..e73d863 100644 --- a/src/error.rs +++ b/src/error.rs @@ -14,6 +14,9 @@ pub enum ErrorKind { TypeError(Op, Vec<Type>), ExternTypeMismatch(String, Vec<Type>), RuntimeTypeError(Op, Vec<Value>), + + IndexOutOfBounds(Value, usize, usize), + Assert, InvalidProgram, Unreachable, @@ -38,6 +41,9 @@ impl fmt::Display for ErrorKind { .fold(String::new(), |a, v| { format!("{}{:?}, ", a, v) }); write!(f, "{} Cannot apply {:?} to types {}", "Type Error".bold(), op, types) } + ErrorKind::IndexOutOfBounds(value, len, slot) => { + write!(f, "{} for {:?} - length is {} but index is {}", "Index Error".bold(), value, len, slot) + } ErrorKind::ExternTypeMismatch(name, types) => { write!(f, "{} Extern function '{}' doesn't accept argument(s) with type(s) {:?}", "Type Error".bold(), name, types) } |
