diff options
author | Nadrieril | 2020-04-14 22:36:40 +0100 |
---|---|---|
committer | Nadrieril | 2020-06-24 22:13:53 +0100 |
commit | 42a9e687e3ecd157779236e893d5564a119dce31 (patch) | |
tree | edd1020314567c2c41b150f53df580e181b956ec /dhall/src/error | |
parent | d99bd58171dfb07cbc7979d093fbc94a74afa0f9 (diff) |
test: use errors instead of panics to signify test failure
Diffstat (limited to 'dhall/src/error')
-rw-r--r-- | dhall/src/error/mod.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/dhall/src/error/mod.rs b/dhall/src/error/mod.rs index 0cfa93c..d533264 100644 --- a/dhall/src/error/mod.rs +++ b/dhall/src/error/mod.rs @@ -92,6 +92,17 @@ impl std::fmt::Display for TypeError { impl std::error::Error for TypeError {} +impl std::fmt::Display for EncodeError { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + let msg = match self { + EncodeError::CBORError(e) => format!("Encode error: {}", e), + }; + write!(f, "{}", msg) + } +} + +impl std::error::Error for EncodeError {} + impl std::fmt::Display for Error { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match &self.kind { |