diff options
Diffstat (limited to 'src/util/error.rs')
-rw-r--r-- | src/util/error.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/error.rs b/src/util/error.rs index cb99cbbc..d2ed1ccf 100644 --- a/src/util/error.rs +++ b/src/util/error.rs @@ -114,3 +114,15 @@ impl<T> From<tokio::sync::mpsc::error::SendError<T>> for Error { Error::Message(format!("MPSC send error")) } } + +impl From<std::str::Utf8Error> for Error { + fn from(e: std::str::Utf8Error) -> Error { + Error::BadRequest(format!("Invalid UTF-8: {}", e)) + } +} + +impl From<roxmltree::Error> for Error { + fn from(e: roxmltree::Error) -> Error { + Error::BadRequest(format!("Invalid XML: {}", e)) + } +} |