aboutsummaryrefslogtreecommitdiff
path: root/lib/xixanta/src/errors.rs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xixanta/src/errors.rs')
-rw-r--r--lib/xixanta/src/errors.rs20
1 files changed, 5 insertions, 15 deletions
diff --git a/lib/xixanta/src/errors.rs b/lib/xixanta/src/errors.rs
index f6317d4..63f925e 100644
--- a/lib/xixanta/src/errors.rs
+++ b/lib/xixanta/src/errors.rs
@@ -27,7 +27,7 @@ impl std::error::Error for ParseError {}
impl fmt::Display for ParseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "parser (line {}): {}.", self.line + 1, self.message)
+ write!(f, "{} (line {})", self.message, self.line + 1)
}
}
@@ -54,14 +54,9 @@ impl std::error::Error for ContextError {}
impl fmt::Display for ContextError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if self.global {
- write!(f, "Context error: {}.", self.message)
+ write!(f, "{}", self.message)
} else {
- write!(
- f,
- "Context error (line {}): {}.",
- self.line + 1,
- self.message
- )
+ write!(f, "{} (line {})", self.message, self.line + 1)
}
}
}
@@ -88,14 +83,9 @@ impl From<ContextError> for EvalError {
impl fmt::Display for EvalError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if self.global {
- write!(f, "Evaluation error: {}.", self.message)
+ write!(f, "{}", self.message)
} else {
- write!(
- f,
- "Evaluation error (line {}): {}.",
- self.line + 1,
- self.message
- )
+ write!(f, "{} (line {})", self.message, self.line + 1)
}
}
}