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. --- net/Cargo.toml | 1 + 1 file changed, 1 insertion(+) (limited to 'net/Cargo.toml') diff --git a/net/Cargo.toml b/net/Cargo.toml index 91775697..06a3ad72 100644 --- a/net/Cargo.toml +++ b/net/Cargo.toml @@ -7,6 +7,7 @@ authors = ["Justus Winter "] openpgp = { path = "../openpgp" } sequoia-core = { path = "../core" } +failure = "0.1.1" fs2 = "0.4.2" futures = "0.1" hyper = "0.11" -- cgit v1.2.3