summaryrefslogtreecommitdiff
path: root/src/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/error.rs b/src/error.rs
index 44459c5..555bf5e 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -9,10 +9,13 @@ use std::string;
error_chain! {
errors {
- Custom(msg: String)
- Parse(msg: String, pos: (usize, usize)) {
+ Custom(msg: String) {
+ description("miscellaneous failure")
+ display("failed with reason: {}", msg)
+ }
+ Parse(msg: String, pos: usize) {
description("parsing failure")
- display("parsing failed with error: '{}' at position: {:?}", msg, pos)
+ display("parsing failed with error: '{}' at position: {}", msg, pos)
}
Unsupported
}
@@ -35,7 +38,7 @@ impl Error {
}
/// Generate a parsing error message with position.
- pub fn parse_err<T>(msg: T, position: (usize, usize)) -> Self
+ pub fn parse_err<T>(msg: T, position: usize) -> Self
where T: Display {
ErrorKind::Parse(msg.to_string(), position).into()
}