1
0

Add error messages

This commit is contained in:
Jeff 2023-10-13 20:16:14 -04:00
parent 96adc4bf77
commit d898696d6c

View File

@ -5,7 +5,7 @@
use crate::{value::Value, Identifier}; use crate::{value::Value, Identifier};
use std::{fmt, io, time::SystemTimeError}; use std::{fmt, io, time};
pub type Result<T> = std::result::Result<T, Error>; pub type Result<T> = std::result::Result<T, Error>;
@ -18,10 +18,6 @@ pub enum Error {
relevant_source: String, relevant_source: String,
}, },
ExpectedChildNode {
empty_node_sexp: String,
},
/// The 'assert' macro did not resolve successfully. /// The 'assert' macro did not resolve successfully.
AssertEqualFailed { AssertEqualFailed {
expected: Value, expected: Value,
@ -162,8 +158,8 @@ impl From<serde_json::Error> for Error {
} }
} }
impl From<SystemTimeError> for Error { impl From<time::SystemTimeError> for Error {
fn from(value: SystemTimeError) -> Self { fn from(value: time::SystemTimeError) -> Self {
Error::ToolFailure(value.to_string()) Error::ToolFailure(value.to_string())
} }
} }
@ -281,10 +277,9 @@ impl fmt::Display for Error {
f, f,
"Expected syntax node {expected}, but got {actual} at {location}. Code: {relevant_source} ", "Expected syntax node {expected}, but got {actual} at {location}. Code: {relevant_source} ",
), ),
ExpectedChildNode { empty_node_sexp } => todo!(), WrongColumnAmount { expected, actual } => write!(f, "Wrong column amount. Expected {expected} but got {actual}."),
WrongColumnAmount { expected, actual } => todo!(), ToolFailure(message) => write!(f, "{message}"),
ToolFailure(_) => todo!(), CustomMessage(message) => write!(f, "{message}"),
CustomMessage(_) => todo!(),
} }
} }
} }