diff --git a/src/error.rs b/src/error.rs index 852d258..bce745e 100644 --- a/src/error.rs +++ b/src/error.rs @@ -29,7 +29,7 @@ pub enum Error { NoFilename, ParsingIncomplete, ParsingError(Vec, ParsingErrorKind), - DecodeError, + DecodeError(Vec), } impl From>> for Error { @@ -61,9 +61,9 @@ impl fmt::Display for Error { "An error was encountered while parsing the plugin content {:02X?}: {}", input, kind ), - Error::DecodeError => write!( + Error::DecodeError(bytes) => write!( f, - "Plugin string content could not be decoded from Windows-1252" + "Plugin string content could not be decoded from Windows-1252, bytes are {bytes:02X?}" ), } } diff --git a/src/plugin.rs b/src/plugin.rs index 285052e..276e318 100644 --- a/src/plugin.rs +++ b/src/plugin.rs @@ -258,7 +258,7 @@ impl Plugin { return WINDOWS_1252 .decode_without_bom_handling_and_without_replacement(data) .map(|s| Some(s.to_string())) - .ok_or(Error::DecodeError); + .ok_or(Error::DecodeError(data.to_vec())); } } @@ -455,7 +455,7 @@ fn masters(header_record: &Record) -> Result, Error> { WINDOWS_1252 .decode_without_bom_handling_and_without_replacement(d) .map(|s| s.to_string()) - .ok_or(Error::DecodeError) + .ok_or(Error::DecodeError(d.to_vec())) }) .collect::, Error>>() }