mirror of
https://github.com/serde-rs/json.git
synced 2025-10-04 00:06:04 +00:00
Provide source method for Error, to allow downcasting cause
This commit is contained in:
parent
38a73b32c1
commit
a59d451809
@ -334,7 +334,7 @@ impl Display for ErrorCode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl error::Error for Error {
|
impl error::Error for Error {
|
||||||
fn cause(&self) -> Option<&error::Error> {
|
fn source(&self) -> Option<&(error::Error + 'static)> {
|
||||||
match self.err.code {
|
match self.err.code {
|
||||||
ErrorCode::Io(ref err) => Some(err),
|
ErrorCode::Io(ref err) => Some(err),
|
||||||
_ => None,
|
_ => None,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user