From 42a9e687e3ecd157779236e893d5564a119dce31 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 14 Apr 2020 22:36:40 +0100 Subject: test: use errors instead of panics to signify test failure --- dhall/src/error/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'dhall/src/error/mod.rs') 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 { -- cgit v1.2.3