Skip to content

Commit 91445b6

Browse files
committed
0.8.1 restore errors not to break compatibility
1 parent cc1b44f commit 91445b6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/error.rs

+6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ pub enum JsonError {
1111
},
1212
UnexpectedEndOfJson,
1313
FailedUtf8Parsing,
14+
ArrayIndexOutOfBounds,
1415
WrongType(String),
16+
UndefinedField(String),
1517
}
1618

1719
impl JsonError {
@@ -33,7 +35,9 @@ impl fmt::Display for JsonError {
3335

3436
UnexpectedEndOfJson => write!(f, "Unexpected end of JSON"),
3537
FailedUtf8Parsing => write!(f, "Failed to parse UTF-8 bytes"),
38+
ArrayIndexOutOfBounds => write!(f, "Array index out of bounds!"),
3639
WrongType(ref s) => write!(f, "Wrong type, expected: {}", s),
40+
UndefinedField(ref s) => write!(f, "Undefined field: {}", s)
3741
}
3842
}
3943
}
@@ -45,7 +49,9 @@ impl Error for JsonError {
4549
UnexpectedCharacter { .. } => "Unexpected character",
4650
UnexpectedEndOfJson => "Unexpected end of JSON",
4751
FailedUtf8Parsing => "Failed to read bytes as UTF-8 from JSON",
52+
ArrayIndexOutOfBounds => "Array index out of bounds!",
4853
WrongType(_) => "Wrong type",
54+
UndefinedField(_) => "Undefined field",
4955
}
5056
}
5157
}

0 commit comments

Comments
 (0)