diff options
| author | Edvard Thörnros <edvard.thornros@gmail.com> | 2021-02-01 21:44:31 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-01 21:44:31 +0100 |
| commit | 8089ff61f5ca608e0801e74360203c6fd789b5d7 (patch) | |
| tree | 4ee11f40d2be5c99739ae39a556396bcdc5f291c /src/error.rs | |
| parent | 354be47619650cd85c1de2a546139c092a88c80f (diff) | |
| parent | 82919eabb21a6df3e57b46912c4513dbd56df827 (diff) | |
| download | sylt-8089ff61f5ca608e0801e74360203c6fd789b5d7.tar.gz | |
Merge pull request #3 from FredTheDino/vectors
vectors
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) } |
