From d01bb57a83b6dbef79e93639f784ee2ff6b72bf4 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Mon, 22 Jan 2018 14:59:34 +0100 Subject: Use the failure crate to handle errors. - The failure crate is a young error handling solution for Rust. It may change the API, but since we pin our dependencies, this should not be a problem for us, albeit a bit inconvenient. - Introduction of the crate is a bit noisy, but not as bad as anticipated, because failure magically handles all errors used in the standard library. - Matching on concrete error values requires downcasting before matching, which seems a bit unidiomatic. This is the cost of using and "chaining" arbitrary error types. This is something that may be improved later on in the library or language. - Having said that, using the error type in the tool was nice. I did not have to use a downcast, so maybe my worries about downcasts are unjustified because it is not such a common use case after all. On the other hand, the tool is quite simple and our only mode of failure is to print the message. --- tool/Cargo.toml | 1 + 1 file changed, 1 insertion(+) (limited to 'tool/Cargo.toml') diff --git a/tool/Cargo.toml b/tool/Cargo.toml index 276f4c7e..43864342 100644 --- a/tool/Cargo.toml +++ b/tool/Cargo.toml @@ -9,6 +9,7 @@ sequoia-core = { path = "../core" } sequoia-net = { path = "../net" } sequoia-store = { path = "../store" } clap = "2.27.1" +failure = "0.1.1" prettytable-rs = "0.6.7" time = "0.1.38" -- cgit v1.2.3