From 678fb659ee1c1bca848b8109a6b620a3865bd048 Mon Sep 17 00:00:00 2001 From: Jeff Date: Thu, 24 Aug 2023 03:50:59 -0400 Subject: [PATCH] Add new error for type checks --- src/error.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/error.rs b/src/error.rs index 49398f2..07bca72 100644 --- a/src/error.rs +++ b/src/error.rs @@ -14,6 +14,12 @@ pub type Result = std::result::Result; #[derive(Debug, Clone, PartialEq)] #[non_exhaustive] pub enum Error { + /// Dust's internal type checking failed to identify a type mismatch. This should never happen, /// the error prompts the user to report the bug. + TypeCheckFailure { + tool_info: ToolInfo<'static>, + argument: Value, + }, + /// The 'assert' macro did not resolve successfully. AssertEqualFailed { expected: Value, @@ -463,6 +469,7 @@ impl fmt::Display for Error { use Error::*; match self { + TypeCheckFailure { tool_info, argument } => write!(f, "Type check failure. This is a bug with the tool or with Dust's internal type checking. Please report this bug and include this error message.\nToolInfo = {tool_info:?}\nargument = {argument}"), AssertEqualFailed {expected, actual } => write!(f, "Equality assertion failed. {expected} does not equal {actual}."), AssertFailed => write!(f, "Assertion failed. A false value was passed to \"assert\"."), ExpectedOperatorArgumentAmount { expected, actual } => write!(