Input: Json parsing errors now contain the parsed text (#31)

This commit is contained in:
Maspenguin
2020-12-13 23:19:49 +11:00
committed by GitHub
parent 700f20dff9
commit 8d6bd4fd63
3 changed files with 29 additions and 26 deletions

View File

@@ -16,7 +16,12 @@ pub enum Error {
/// An error occurred while reading, or opening a file.
Io(IoError),
/// An error occurred while parsing JSON (i.e., during metadata/stereo detection).
Json(JsonError),
Json {
/// Json error
error: JsonError,
/// Text that failed to be parsed
parsed_text: String,
},
/// An error occurred within the Opus codec.
Opus(OpusError),
/// Failed to extract metadata from alternate pipe.
@@ -57,12 +62,6 @@ impl From<IoError> for Error {
}
}
impl From<JsonError> for Error {
fn from(e: JsonError) -> Self {
Error::Json(e)
}
}
impl From<OpusError> for Error {
fn from(e: OpusError) -> Error {
Error::Opus(e)