From 4253c1c20013ab16564aa3ec34585dd1a358d182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edvard=20Th=C3=B6rnros?= Date: Sat, 30 Jan 2021 22:34:19 +0100 Subject: add in tuples --- src/error.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/error.rs') 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), ExternTypeMismatch(String, Vec), RuntimeTypeError(Op, Vec), + + 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) } -- cgit v1.2.1