Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions json/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ impl Error {
self
}
}

/// Extract the syntax error, if present
pub fn syntax_error(&self) -> Option<(ErrorCode, usize, usize)> {
let error_impl = self.err.as_ref();
match error_impl {
&ErrorImpl::Syntax(ref ec, line, col) => Some((ec.clone(), line, col)),
_ => None
}
}
}

impl Display for ErrorCode {
Expand Down