diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2019-10-17 13:14:30 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2019-10-17 14:55:04 +0200 |
| commit | 55674d9160cbc03bf9e20b16871e2870b1d0bb4c (patch) | |
| tree | f408a0512db98d610381c1f50750fb3496f002f6 | |
| parent | 818c435de10d27357a8c8afb481bce68d9fee894 (diff) | |
| download | mullvadvpn-55674d9160cbc03bf9e20b16871e2870b1d0bb4c.tar.xz mullvadvpn-55674d9160cbc03bf9e20b16871e2870b1d0bb4c.zip | |
Upgrade err-derive to 0.2.1
59 files changed, 226 insertions, 214 deletions
diff --git a/Cargo.lock b/Cargo.lock index 379b7af3e5..23d2610ea4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -421,19 +421,6 @@ dependencies = [ ] [[package]] -name = "derive_more" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] name = "digest" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -512,6 +499,19 @@ dependencies = [ ] [[package]] +name = "err-derive" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "errno" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1211,7 +1211,7 @@ dependencies = [ "chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "err-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "err-derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "mullvad-ipc-client 0.1.0", "mullvad-paths 0.1.0", @@ -1232,7 +1232,7 @@ dependencies = [ "chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "ctrlc 3.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "err-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "err-derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "fern 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "ipnetwork 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1271,7 +1271,7 @@ dependencies = [ name = "mullvad-ipc-client" version = "0.1.0" dependencies = [ - "err-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "err-derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-client-core 0.5.0 (git+https://github.com/mullvad/jsonrpc-client-rs?rev=68aac55b)", "jsonrpc-client-ipc 0.5.0 (git+https://github.com/mullvad/jsonrpc-client-rs?rev=68aac55b)", @@ -1291,7 +1291,7 @@ dependencies = [ name = "mullvad-jni" version = "0.1.0" dependencies = [ - "err-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "err-derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "ipnetwork 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "jni 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1314,7 +1314,7 @@ name = "mullvad-paths" version = "0.1.0" dependencies = [ "dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "err-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "err-derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1326,7 +1326,7 @@ dependencies = [ "dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "duct 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "err-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "err-derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "mullvad-paths 0.1.0", "mullvad-rpc 0.1.0", @@ -1344,8 +1344,7 @@ name = "mullvad-rpc" version = "0.1.0" dependencies = [ "chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", - "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", - "err-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "err-derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.11.27 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1389,7 +1388,7 @@ name = "mullvad-types" version = "0.1.0" dependencies = [ "chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", - "err-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "err-derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "ipnetwork 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2389,9 +2388,8 @@ dependencies = [ "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "dbus 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "duct 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "err-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "err-derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2441,7 +2439,7 @@ version = "0.1.0" dependencies = [ "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "err-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "err-derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-client-core 0.5.0 (git+https://github.com/mullvad/jsonrpc-client-rs?rev=68aac55b)", "jsonrpc-client-ipc 0.5.0 (git+https://github.com/mullvad/jsonrpc-client-rs?rev=68aac55b)", @@ -2461,7 +2459,7 @@ name = "talpid-openvpn-plugin" version = "2019.9.0" dependencies = [ "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "err-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "err-derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-client-core 0.5.0 (git+https://github.com/mullvad/jsonrpc-client-rs?rev=68aac55b)", "jsonrpc-client-ipc 0.5.0 (git+https://github.com/mullvad/jsonrpc-client-rs?rev=68aac55b)", @@ -2480,7 +2478,7 @@ name = "talpid-types" version = "0.1.0" dependencies = [ "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", - "err-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "err-derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "ipnetwork 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3160,7 +3158,6 @@ dependencies = [ "checksum derive-try-from-primitive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "81dbd65eb15734b6d50dc6ac86f14f928462be0a5df6bda17761e909071ede5d" "checksum derive_builder 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3ac53fa6a3cda160df823a9346442525dcaf1e171999a1cf23e67067e4fd64d4" "checksum derive_builder_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0288a23da9333c246bb18c143426074a6ae96747995c5819d2947b64cd942b37" -"checksum derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a141330240c921ec6d074a3e188a7c7ef95668bb95e7d44fa0e5778ec2a7afe" "checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" "checksum dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" "checksum dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b" @@ -3169,6 +3166,7 @@ dependencies = [ "checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" "checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" "checksum err-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b41487fadaa500d02a819eefcde5f713599a01dd51626ef25d2d72d87115667b" +"checksum err-derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ead97ef6ef5530312e584d24b1ef31e96455bc2135945109fc737fe8b62ff4a5" "checksum errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2a071601ed01b988f896ab14b95e67335d1eeb50190932a1320f7fe3cadc84e" "checksum errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067" "checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3" diff --git a/mullvad-cli/Cargo.toml b/mullvad-cli/Cargo.toml index 749ebe6b55..32d4b937b2 100644 --- a/mullvad-cli/Cargo.toml +++ b/mullvad-cli/Cargo.toml @@ -21,7 +21,7 @@ path = "src/main.rs" base64 = "0.10" chrono = { version = "0.4", features = ["serde"] } clap = "2.32" -err-derive = "0.1.5" +err-derive = "0.2.1" env_logger = "0.7" futures = "0.1" natord = "1.0.9" diff --git a/mullvad-cli/src/main.rs b/mullvad-cli/src/main.rs index 4abe16224c..7547b0b1cd 100644 --- a/mullvad-cli/src/main.rs +++ b/mullvad-cli/src/main.rs @@ -23,25 +23,19 @@ pub type Result<T> = std::result::Result<T, Error>; #[derive(err_derive::Error, Debug)] pub enum Error { #[error(display = "Failed to connect to daemon")] - DaemonNotRunning(#[error(cause)] io::Error), + DaemonNotRunning(#[error(source)] io::Error), #[error(display = "Can't subscribe to daemon states")] - CantSubscribe(#[error(cause)] mullvad_ipc_client::PubSubError), + CantSubscribe(#[error(source)] mullvad_ipc_client::PubSubError), #[error(display = "Failed to communicate with mullvad-daemon over RPC")] - RpcClientError(#[error(cause)] mullvad_ipc_client::Error), + RpcClientError(#[error(source)] mullvad_ipc_client::Error), /// The given command is not correct in some way #[error(display = "Invalid command: {}", _0)] InvalidCommand(&'static str), } -impl From<mullvad_ipc_client::Error> for Error { - fn from(e: mullvad_ipc_client::Error) -> Self { - Error::RpcClientError(e) - } -} - pub fn new_rpc_client() -> Result<DaemonRpcClient> { match new_standalone_ipc_client(&mullvad_paths::get_rpc_socket_path()) { Err(e) => Err(Error::DaemonNotRunning(e)), diff --git a/mullvad-daemon/Cargo.toml b/mullvad-daemon/Cargo.toml index 039b8b679b..04655d4ed2 100644 --- a/mullvad-daemon/Cargo.toml +++ b/mullvad-daemon/Cargo.toml @@ -16,7 +16,7 @@ edition = "2018" [dependencies] chrono = { version = "0.4", features = ["serde"] } clap = "2.25" -err-derive = "0.1.5" +err-derive = "0.2.1" fern = { version = "0.5", features = ["colored"] } futures = "0.1" ipnetwork = "0.15" diff --git a/mullvad-daemon/src/account_history.rs b/mullvad-daemon/src/account_history.rs index 7ba5894190..a5fae4ce6d 100644 --- a/mullvad-daemon/src/account_history.rs +++ b/mullvad-daemon/src/account_history.rs @@ -10,15 +10,16 @@ use talpid_types::ErrorExt; pub type Result<T> = std::result::Result<T, Error>; #[derive(err_derive::Error, Debug)] +#[error(no_from)] pub enum Error { #[error(display = "Unable to read account history file")] - Read(#[error(cause)] io::Error), + Read(#[error(source)] io::Error), #[error(display = "Failed to serialize account history")] - Serialize(#[error(cause)] serde_json::Error), + Serialize(#[error(source)] serde_json::Error), #[error(display = "Unable to write account history file")] - Write(#[error(cause)] io::Error), + Write(#[error(source)] io::Error), } static ACCOUNT_HISTORY_FILE: &str = "account-history.json"; diff --git a/mullvad-daemon/src/geoip.rs b/mullvad-daemon/src/geoip.rs index 7caa1c4951..5be502f0a9 100644 --- a/mullvad-daemon/src/geoip.rs +++ b/mullvad-daemon/src/geoip.rs @@ -19,11 +19,11 @@ pub enum Error { /// Error in the HTTP client when requesting GeoIP #[error(display = "Failed to request GeoIP")] - Transport(#[error(cause)] mullvad_rpc::rest::Error), + Transport(#[error(source)] mullvad_rpc::rest::Error), /// Failed to deserialize GeoIP response #[error(display = "Failed to deserialize GeoIP response")] - Deserialize(#[error(cause)] serde_json::error::Error), + Deserialize(#[error(source)] serde_json::error::Error), } diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs index e6e6c39ab8..84bd8a1453 100644 --- a/mullvad-daemon/src/lib.rs +++ b/mullvad-daemon/src/lib.rs @@ -67,6 +67,7 @@ mod wireguard; pub type Result<T> = std::result::Result<T, Error>; #[derive(err_derive::Error, Debug)] +#[error(no_from)] pub enum Error { #[error(display = "Another instance of the daemon is already running")] DaemonIsAlreadyRunning, @@ -75,20 +76,20 @@ pub enum Error { DaemonUnavailable, #[error(display = "Unable to initialize network event loop")] - InitIoEventLoop(#[error(cause)] io::Error), + InitIoEventLoop(#[error(source)] io::Error), #[error(display = "Unable to create RPC client")] - InitRpcClient(#[error(cause)] mullvad_rpc::HttpError), + InitRpcClient(#[error(source)] mullvad_rpc::HttpError), #[error(display = "Unable to create am.i.mullvad client")] - InitHttpsClient(#[error(cause)] mullvad_rpc::rest::Error), + InitHttpsClient(#[error(source)] mullvad_rpc::rest::Error), #[error(display = "Unable to load account history with wireguard key cache")] - LoadAccountHistory(#[error(cause)] account_history::Error), + LoadAccountHistory(#[error(source)] account_history::Error), /// Error in the management interface #[error(display = "Unable to start management interface server")] - StartManagementInterface(#[error(cause)] talpid_ipc::Error), + StartManagementInterface(#[error(source)] talpid_ipc::Error), #[error(display = "Management interface server exited unexpectedly")] ManagementInterfaceExited, @@ -100,31 +101,31 @@ pub enum Error { NoBridgeAvailable, #[error(display = "Account history problems")] - AccountHistory(#[error(cause)] account_history::Error), + AccountHistory(#[error(source)] account_history::Error), #[error(display = "Tunnel state machine error")] - TunnelError(#[error(cause)] tunnel_state_machine::Error), + TunnelError(#[error(source)] tunnel_state_machine::Error), #[error(display = "Failed to remove directory {}", _0)] - RemoveDirError(String, #[error(cause)] io::Error), + RemoveDirError(String, #[error(source)] io::Error), #[error(display = "Failed to create directory {}", _0)] - CreateDirError(String, #[error(cause)] io::Error), + CreateDirError(String, #[error(source)] io::Error), #[error(display = "Failed to get path")] - PathError(#[error(cause)] mullvad_paths::Error), + PathError(#[error(source)] mullvad_paths::Error), #[cfg(target_os = "windows")] #[error(display = "Failed to get file type info")] - FileTypeError(#[error(cause)] io::Error), + FileTypeError(#[error(source)] io::Error), #[cfg(target_os = "windows")] #[error(display = "Failed to get dir entry")] - FileEntryError(#[error(cause)] io::Error), + FileEntryError(#[error(source)] io::Error), #[cfg(target_os = "windows")] #[error(display = "Failed to read dir entries")] - ReadDirError(#[error(cause)] io::Error), + ReadDirError(#[error(source)] io::Error), } type SyncUnboundedSender<T> = ::futures::sink::Wait<UnboundedSender<T>>; diff --git a/mullvad-daemon/src/logging.rs b/mullvad-daemon/src/logging.rs index 2ffac0f1bc..887ddd1268 100644 --- a/mullvad-daemon/src/logging.rs +++ b/mullvad-daemon/src/logging.rs @@ -13,15 +13,15 @@ pub enum Error { #[error(display = "Unable to open log file for writing: {}", path)] WriteFile { path: String, - #[error(cause)] + #[error(source)] source: io::Error, }, #[error(display = "Unable to rotate daemon log file")] - RotateLog(#[error(cause)] talpid_core::logging::RotateLogError), + RotateLog(#[error(source)] talpid_core::logging::RotateLogError), #[error(display = "Unable to set logger")] - SetLoggerError(#[error(cause)] log::SetLoggerError), + SetLoggerError(#[error(source)] log::SetLoggerError), } pub const SILENCED_CRATES: &[&str] = &[ diff --git a/mullvad-daemon/src/relays.rs b/mullvad-daemon/src/relays.rs index 34c699e832..def5dd313c 100644 --- a/mullvad-daemon/src/relays.rs +++ b/mullvad-daemon/src/relays.rs @@ -40,15 +40,16 @@ const UPDATE_CHECK_INTERVAL: Duration = Duration::from_secs(60 * 5); const UPDATE_INTERVAL: Duration = Duration::from_secs(3600); #[derive(err_derive::Error, Debug)] +#[error(no_from)] pub enum Error { #[error(display = "Failed to open relay cache file for reading")] - ReadCachedRelays(#[error(cause)] io::Error), + ReadCachedRelays(#[error(source)] io::Error), #[error(display = "Failed to open relay cache file for writing")] - WriteRelayCache(#[error(cause)] io::Error), + WriteRelayCache(#[error(source)] io::Error), #[error(display = "Failed to download the list of relays")] - Download(#[error(cause)] mullvad_rpc::Error), + Download(#[error(source)] mullvad_rpc::Error), #[error(display = "Timed out when trying to download the list of relays")] DownloadTimeout, @@ -57,7 +58,7 @@ pub enum Error { NoRelay, #[error(display = "Failure in serialization of the relay list")] - Serialize(#[error(cause)] serde_json::Error), + Serialize(#[error(source)] serde_json::Error), } impl<F> From<TimeoutError<F>> for Error { diff --git a/mullvad-daemon/src/shutdown.rs b/mullvad-daemon/src/shutdown.rs index 8a179cd6c5..8dff1bc553 100644 --- a/mullvad-daemon/src/shutdown.rs +++ b/mullvad-daemon/src/shutdown.rs @@ -16,7 +16,7 @@ mod platform { mod platform { #[derive(err_derive::Error, Debug)] #[error(display = "Unable to attach ctrl-c handler")] - pub struct Error(#[error(cause)] ctrlc::Error); + pub struct Error(#[error(source)] ctrlc::Error); pub fn set_shutdown_signal_handler(f: impl Fn() + 'static + Send) -> Result<(), Error> { ctrlc::set_handler(move || { diff --git a/mullvad-daemon/src/system_service.rs b/mullvad-daemon/src/system_service.rs index c7007ae666..ea273ee395 100644 --- a/mullvad-daemon/src/system_service.rs +++ b/mullvad-daemon/src/system_service.rs @@ -234,12 +234,13 @@ fn accepted_controls_by_state(state: ServiceState) -> ServiceControlAccept { } #[derive(err_derive::Error, Debug)] +#[error(no_from)] pub enum InstallError { #[error(display = "Unable to connect to service manager")] - ConnectServiceManager(#[error(cause)] windows_service::Error), + ConnectServiceManager(#[error(source)] windows_service::Error), #[error(display = "Unable to create a service")] - CreateService(#[error(cause)] windows_service::Error), + CreateService(#[error(source)] windows_service::Error), } pub fn install_service() -> Result<(), InstallError> { diff --git a/mullvad-daemon/src/version_check.rs b/mullvad-daemon/src/version_check.rs index a55b33a4f0..6a89ee8060 100644 --- a/mullvad-daemon/src/version_check.rs +++ b/mullvad-daemon/src/version_check.rs @@ -34,21 +34,22 @@ const PLATFORM: &str = "android"; #[derive(err_derive::Error, Debug)] +#[error(no_from)] pub enum Error { #[error(display = "Failed to open app version cache file for reading")] - ReadCachedRelays(#[error(cause)] io::Error), + ReadCachedRelays(#[error(source)] io::Error), #[error(display = "Failed to open app version cache file for writing")] - WriteRelayCache(#[error(cause)] io::Error), + WriteRelayCache(#[error(source)] io::Error), #[error(display = "Failure in serialization of the version info")] - Serialize(#[error(cause)] serde_json::Error), + Serialize(#[error(source)] serde_json::Error), #[error(display = "Timed out when trying to check the latest app version")] DownloadTimeout, #[error(display = "Failed to check the latest app version")] - Download(#[error(cause)] mullvad_rpc::Error), + Download(#[error(source)] mullvad_rpc::Error), } impl<F> From<TimeoutError<F>> for Error { diff --git a/mullvad-daemon/src/wireguard.rs b/mullvad-daemon/src/wireguard.rs index 623d2538fd..0290d7a750 100644 --- a/mullvad-daemon/src/wireguard.rs +++ b/mullvad-daemon/src/wireguard.rs @@ -21,11 +21,11 @@ const TOO_MANY_KEYS_ERROR_CODE: i64 = -703; #[derive(err_derive::Error, Debug)] pub enum Error { #[error(display = "Failed to generate private key")] - GenerationError(#[error(cause)] rand::Error), + GenerationError(#[error(source)] rand::Error), #[error(display = "Failed to spawn future")] ExectuionError, #[error(display = "Unexpected RPC error")] - RpcError(#[error(cause)] jsonrpc_client_core::Error), + RpcError(#[error(source)] jsonrpc_client_core::Error), #[error(display = "Account already has maximum number of keys")] TooManyKeys, } diff --git a/mullvad-ipc-client/Cargo.toml b/mullvad-ipc-client/Cargo.toml index 2d025418a5..5712eb90c9 100644 --- a/mullvad-ipc-client/Cargo.toml +++ b/mullvad-ipc-client/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" edition = "2018" [dependencies] -err-derive = "0.1.5" +err-derive = "0.2.1" mullvad-types = { path = "../mullvad-types" } serde = "1.0" talpid-ipc = { path = "../talpid-ipc" } diff --git a/mullvad-jni/Cargo.toml b/mullvad-jni/Cargo.toml index 30b26af6fe..b8b1711e10 100644 --- a/mullvad-jni/Cargo.toml +++ b/mullvad-jni/Cargo.toml @@ -10,7 +10,7 @@ edition = "2018" crate_type = ["cdylib"] [dependencies] -err-derive = "0.1.5" +err-derive = "0.2.1" futures = "0.1" ipnetwork = "0.15" jni = "0.13" diff --git a/mullvad-jni/src/daemon_interface.rs b/mullvad-jni/src/daemon_interface.rs index 2820315c74..2da8ffecb7 100644 --- a/mullvad-jni/src/daemon_interface.rs +++ b/mullvad-jni/src/daemon_interface.rs @@ -15,7 +15,7 @@ use parking_lot::Mutex; #[derive(Debug, err_derive::Error)] pub enum Error { #[error(display = "Can't send command to daemon because it is not running")] - NoDaemon(#[error(cause)] mullvad_daemon::Error), + NoDaemon(#[error(source)] mullvad_daemon::Error), #[error(display = "No response received from daemon")] NoResponse, @@ -24,7 +24,7 @@ pub enum Error { NoSender, #[error(display = "Error performing RPC with the remote API")] - RpcError(#[error(cause)] jsonrpc_client_core::Error), + RpcError(#[error(source)] jsonrpc_client_core::Error), } type Result<T> = std::result::Result<T, Error>; diff --git a/mullvad-jni/src/jni_event_listener.rs b/mullvad-jni/src/jni_event_listener.rs index 737fa1b9b2..5725171ca1 100644 --- a/mullvad-jni/src/jni_event_listener.rs +++ b/mullvad-jni/src/jni_event_listener.rs @@ -13,15 +13,16 @@ use std::{sync::mpsc, thread}; use talpid_types::ErrorExt; #[derive(Debug, err_derive::Error)] +#[error(no_from)] pub enum Error { #[error(display = "Failed to create global reference to MullvadDaemon Java object")] - CreateGlobalReference(#[error(cause)] jni::errors::Error), + CreateGlobalReference(#[error(source)] jni::errors::Error), #[error(display = "Failed to find {} method", _0)] - FindMethod(&'static str, #[error(cause)] jni::errors::Error), + FindMethod(&'static str, #[error(source)] jni::errors::Error), #[error(display = "Failed to retrieve Java VM instance")] - GetJvmInstance(#[error(cause)] jni::errors::Error), + GetJvmInstance(#[error(source)] jni::errors::Error), } enum Event { diff --git a/mullvad-jni/src/lib.rs b/mullvad-jni/src/lib.rs index e4ed6c83a5..7c9d3ba50a 100644 --- a/mullvad-jni/src/lib.rs +++ b/mullvad-jni/src/lib.rs @@ -101,24 +101,25 @@ lazy_static! { static LOAD_CLASSES: Once = Once::new(); #[derive(Debug, err_derive::Error)] +#[error(no_from)] pub enum Error { #[error(display = "Failed to create VpnService tunnel provider")] - CreateVpnServiceTunProvider(#[error(cause)] vpn_service_tun_provider::Error), + CreateVpnServiceTunProvider(#[error(source)] vpn_service_tun_provider::Error), #[error(display = "Failed to get cache directory path")] - GetCacheDir(#[error(cause)] mullvad_paths::Error), + GetCacheDir(#[error(source)] mullvad_paths::Error), #[error(display = "Failed to get log directory path")] - GetLogDir(#[error(cause)] mullvad_paths::Error), + GetLogDir(#[error(source)] mullvad_paths::Error), #[error(display = "Failed to initialize the mullvad daemon")] - InitializeDaemon(#[error(cause)] mullvad_daemon::Error), + InitializeDaemon(#[error(source)] mullvad_daemon::Error), #[error(display = "Failed to spawn the JNI event listener")] - SpawnJniEventListener(#[error(cause)] jni_event_listener::Error), + SpawnJniEventListener(#[error(source)] jni_event_listener::Error), #[error(display = "Failed to start logger")] - StartLogging(#[error(cause)] logging::Error), + StartLogging(#[error(source)] logging::Error), } #[no_mangle] diff --git a/mullvad-jni/src/vpn_service_tun_provider.rs b/mullvad-jni/src/vpn_service_tun_provider.rs index 7f83661d8a..7da3ca3eef 100644 --- a/mullvad-jni/src/vpn_service_tun_provider.rs +++ b/mullvad-jni/src/vpn_service_tun_provider.rs @@ -17,27 +17,28 @@ use talpid_types::BoxedError; /// Errors that occur while setting up VpnService tunnel. #[derive(Debug, err_derive::Error)] #[error(display = "Failed to set up the VpnService")] +#[error(no_from)] pub enum Error { #[error(display = "Failed to attach Java VM to tunnel thread")] - AttachJvmToThread(#[error(cause)] jni::errors::Error), + AttachJvmToThread(#[error(source)] jni::errors::Error), #[error(display = "Failed to allow socket to bypass tunnel")] Bypass, #[error(display = "Failed to call Java method MullvadVpnService.{}", _0)] - CallMethod(&'static str, #[error(cause)] jni::errors::Error), + CallMethod(&'static str, #[error(source)] jni::errors::Error), #[error(display = "Failed to create Java VM handle clone")] - CloneJavaVm(#[error(cause)] jni::errors::Error), + CloneJavaVm(#[error(source)] jni::errors::Error), #[error(display = "Failed to create global reference to MullvadVpnService instance")] - CreateGlobalReference(#[error(cause)] jni::errors::Error), + CreateGlobalReference(#[error(source)] jni::errors::Error), #[error(display = "Failed to find MullvadVpnService.{} method", _0)] - FindMethod(&'static str, #[error(cause)] jni::errors::Error), + FindMethod(&'static str, #[error(source)] jni::errors::Error), #[error(display = "Failed to get Java VM instance")] - GetJvmInstance(#[error(cause)] jni::errors::Error), + GetJvmInstance(#[error(source)] jni::errors::Error), #[error( display = "Received an invalid result from MullvadVpnService.{}: {}", diff --git a/mullvad-paths/Cargo.toml b/mullvad-paths/Cargo.toml index 7443112728..5d7be90978 100644 --- a/mullvad-paths/Cargo.toml +++ b/mullvad-paths/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" edition = "2018" [dependencies] -err-derive = "0.1.5" +err-derive = "0.2.1" log = "0.4" [target.'cfg(any(windows, target_os = "macos"))'.dependencies] diff --git a/mullvad-paths/src/lib.rs b/mullvad-paths/src/lib.rs index e931b02a25..1e146d3f73 100644 --- a/mullvad-paths/src/lib.rs +++ b/mullvad-paths/src/lib.rs @@ -7,10 +7,10 @@ pub type Result<T> = std::result::Result<T, Error>; #[derive(err_derive::Error, Debug)] pub enum Error { #[error(display = "Failed to create directory {}", _0)] - CreateDirFailed(String, #[error(cause)] io::Error), + CreateDirFailed(String, #[error(source)] io::Error), #[error(display = "Failed to set directory permissions on {}", _0)] - SetDirPermissionFailed(String, #[error(cause)] io::Error), + SetDirPermissionFailed(String, #[error(source)] io::Error), #[cfg(any(windows, target_os = "macos"))] #[error(display = "Not able to find requested directory")] diff --git a/mullvad-problem-report/Cargo.toml b/mullvad-problem-report/Cargo.toml index 895320db56..ddd134f145 100644 --- a/mullvad-problem-report/Cargo.toml +++ b/mullvad-problem-report/Cargo.toml @@ -17,7 +17,7 @@ edition = "2018" clap = "2.25" dirs = "2.0" env_logger = "0.7" -err-derive = "0.1.5" +err-derive = "0.2.1" lazy_static = "1.0" regex = "1.0" tokio-core = "0.1" diff --git a/mullvad-problem-report/src/lib.rs b/mullvad-problem-report/src/lib.rs index 344d651e41..acd87782e1 100644 --- a/mullvad-problem-report/src/lib.rs +++ b/mullvad-problem-report/src/lib.rs @@ -59,22 +59,22 @@ pub enum Error { #[error(display = "Failed to write the problem report to {}", path)] WriteReportError { path: String, - #[error(cause)] + #[error(source)] source: io::Error, }, #[error(display = "Failed to read the problem report at {}", path)] ReadProblemReportError { path: String, - #[error(cause)] + #[error(source)] source: io::Error, }, #[error(display = "Unable to create JSON-RPC 2.0 client")] - CreateRpcClientError(#[error(cause)] mullvad_rpc::HttpError), + CreateRpcClientError(#[error(source)] mullvad_rpc::HttpError), #[error(display = "Error during RPC call")] - SendRpcError(#[error(cause)] mullvad_rpc::Error), + SendRpcError(#[error(source)] mullvad_rpc::Error), } /// These are errors that can happen during problem report collection. @@ -88,7 +88,7 @@ pub enum LogError { #[error(display = "Failed to list the files in the log directory: {}", path)] ListLogDir { path: String, - #[error(cause)] + #[error(source)] source: io::Error, }, diff --git a/mullvad-rpc/Cargo.toml b/mullvad-rpc/Cargo.toml index 7436200222..13dd025514 100644 --- a/mullvad-rpc/Cargo.toml +++ b/mullvad-rpc/Cargo.toml @@ -8,8 +8,7 @@ edition = "2018" [dependencies] chrono = { version = "0.4", features = ["serde"] } -derive_more = "0.15" -err-derive = "0.1.5" +err-derive = "0.2.1" futures = "0.1.15" jsonrpc-client-core = "0.5" jsonrpc-client-http = "0.5" diff --git a/mullvad-rpc/src/cached_dns_resolver.rs b/mullvad-rpc/src/cached_dns_resolver.rs index 2494f64c11..2c5790ef5f 100644 --- a/mullvad-rpc/src/cached_dns_resolver.rs +++ b/mullvad-rpc/src/cached_dns_resolver.rs @@ -21,7 +21,7 @@ pub type Result<T> = std::result::Result<T, Error>; pub enum Error { /// DNS resolution for a host took too long #[error(display = "DNS resolution for \"{}\" timed out", _0)] - DnsTimeout(String, #[error(cause)] mpsc::RecvTimeoutError), + DnsTimeout(String, #[error(source)] mpsc::RecvTimeoutError), /// DNS resolution for a host didn't return any IP addresses #[error(display = "DNS resolution for \"{}\" did not return any IPs", _0)] @@ -29,15 +29,15 @@ pub enum Error { /// Failed to resolve IP address for host #[error(display = "Failed to resolve IP address for \"{}\"", _0)] - ResolveFailure(String, #[error(cause)] io::Error), + ResolveFailure(String, #[error(source)] io::Error), /// Unable to read IP cache file #[error(display = "Failed to read DNS IP cache file")] - ReadCacheError(#[error(cause)] io::Error), + ReadCacheError(#[error(source)] io::Error), /// Address loaded from file is invalid #[error(display = "Address loaded from file is invalid")] - ParseCacheError(#[error(cause)] std::net::AddrParseError), + ParseCacheError(#[error(source)] std::net::AddrParseError), } diff --git a/mullvad-rpc/src/rest.rs b/mullvad-rpc/src/rest.rs index 76548f0560..e6acb7ddb9 100644 --- a/mullvad-rpc/src/rest.rs +++ b/mullvad-rpc/src/rest.rs @@ -12,7 +12,7 @@ use tokio_core::reactor::Handle; pub type Result<T> = std::result::Result<T, Error>; -#[derive(derive_more::From, err_derive::Error, Debug)] +#[derive(err_derive::Error, Debug)] pub enum Error { /// When the http status code of the response is not 200 OK. #[error(display = "Http error. Status code {}", _0)] @@ -20,15 +20,15 @@ pub enum Error { /// An error occured in Hyper. #[error(display = "Error in HTTP client")] - Hyper(#[error(cause)] hyper::Error), + Hyper(#[error(source)] hyper::Error), /// The string given was not a valid URI. #[error(display = "Not a valid URI")] - Uri(#[error(cause)] hyper::error::UriError), + Uri(#[error(source)] hyper::error::UriError), /// Error in OpenSSL #[error(display = "Error in OpenSSL")] - OpenSsl(#[error(cause)] ErrorStack), + OpenSsl(#[error(source)] ErrorStack), } diff --git a/mullvad-types/Cargo.toml b/mullvad-types/Cargo.toml index 70b9ae9295..f02cbc0dab 100644 --- a/mullvad-types/Cargo.toml +++ b/mullvad-types/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" [dependencies] chrono = { version = "0.4", features = ["serde"] } -err-derive = "0.1.5" +err-derive = "0.2.1" ipnetwork = "0.15" lazy_static = "1.1.0" log = "0.4" diff --git a/mullvad-types/src/custom_tunnel.rs b/mullvad-types/src/custom_tunnel.rs index dbf985f86b..ea84e28979 100644 --- a/mullvad-types/src/custom_tunnel.rs +++ b/mullvad-types/src/custom_tunnel.rs @@ -10,7 +10,7 @@ use talpid_types::net::{openvpn, wireguard, Endpoint, TunnelParameters}; #[derive(err_derive::Error, Debug)] pub enum Error { #[error(display = "Invalid host/domain: {}", _0)] - InvalidHost(String, #[error(cause)] io::Error), + InvalidHost(String, #[error(source)] io::Error), #[error(display = "Host has no IPv4 address: {}", _0)] HostHasNoIpv4(String), diff --git a/mullvad-types/src/settings/mod.rs b/mullvad-types/src/settings/mod.rs index a7b803ea25..87a2d39276 100644 --- a/mullvad-types/src/settings/mod.rs +++ b/mullvad-types/src/settings/mod.rs @@ -20,24 +20,25 @@ mod migrations; pub type Result<T> = std::result::Result<T, Error>; #[derive(err_derive::Error, Debug)] +#[error(no_from)] pub enum Error { #[error(display = "Unable to create settings directory")] - DirectoryError(#[error(cause)] mullvad_paths::Error), + DirectoryError(#[error(source)] mullvad_paths::Error), #[error(display = "Unable to read settings from {}", _0)] - ReadError(String, #[error(cause)] io::Error), + ReadError(String, #[error(source)] io::Error), #[error(display = "Unable to remove settings file {}", _0)] - DeleteError(String, #[error(cause)] io::Error), + DeleteError(String, #[error(source)] io::Error), #[error(display = "Malformed settings")] - ParseError(#[error(cause)] serde_json::Error), + ParseError(#[error(source)] serde_json::Error), #[error(display = "Unable to serialize settings to JSON")] - SerializeError(#[error(cause)] serde_json::Error), + SerializeError(#[error(source)] serde_json::Error), #[error(display = "Unable to write settings to {}", _0)] - WriteError(String, #[error(cause)] io::Error), + WriteError(String, #[error(source)] io::Error), #[error(display = "Invalid OpenVPN proxy configuration: {}", _0)] InvalidProxyData(String), diff --git a/talpid-core/Cargo.toml b/talpid-core/Cargo.toml index e9df3eb69f..0caf1df2b0 100644 --- a/talpid-core/Cargo.toml +++ b/talpid-core/Cargo.toml @@ -9,9 +9,8 @@ edition = "2018" [dependencies] atty = "0.2" cfg-if = "0.1" -derive_more = "0.15" duct = "0.12" -err-derive = "0.1.5" +err-derive = "0.2.1" futures = "0.1" ipnetwork = "0.15" jsonrpc-core = { git = "https://github.com/mullvad/jsonrpc", branch = "mullvad-fork" } diff --git a/talpid-core/src/dns/linux/mod.rs b/talpid-core/src/dns/linux/mod.rs index 4e379d01f3..f2c7af8a0f 100644 --- a/talpid-core/src/dns/linux/mod.rs +++ b/talpid-core/src/dns/linux/mod.rs @@ -15,23 +15,23 @@ const RESOLV_CONF_PATH: &str = "/etc/resolv.conf"; pub type Result<T> = std::result::Result<T, Error>; /// Errors that can happen in the Linux DNS monitor -#[derive(err_derive::Error, derive_more::From, Debug)] +#[derive(err_derive::Error, Debug)] pub enum Error { /// Error in systemd-resolved DNS monitor #[error(display = "Error in systemd-resolved DNS monitor")] - SystemdResolved(#[error(cause)] systemd_resolved::Error), + SystemdResolved(#[error(source)] systemd_resolved::Error), /// Error in NetworkManager DNS monitor #[error(display = "Error in NetworkManager DNS monitor")] - NetworkManager(#[error(cause)] network_manager::Error), + NetworkManager(#[error(source)] network_manager::Error), /// Error in resolvconf DNS monitor #[error(display = "Error in resolvconf DNS monitor")] - Resolvconf(#[error(cause)] resolvconf::Error), + Resolvconf(#[error(source)] resolvconf::Error), /// Error in static /etc/resolv.conf DNS monitor #[error(display = "Error in static /etc/resolv.conf DNS monitor")] - StaticResolvConf(#[error(cause)] static_resolv_conf::Error), + StaticResolvConf(#[error(source)] static_resolv_conf::Error), /// No suitable DNS monitor implementation detected #[error(display = "No suitable DNS monitor implementation detected")] diff --git a/talpid-core/src/dns/linux/network_manager.rs b/talpid-core/src/dns/linux/network_manager.rs index ac3059bf2e..09cbd1f165 100644 --- a/talpid-core/src/dns/linux/network_manager.rs +++ b/talpid-core/src/dns/linux/network_manager.rs @@ -14,18 +14,19 @@ use std::{ pub type Result<T> = std::result::Result<T, Error>; #[derive(err_derive::Error, Debug)] +#[error(no_from)] pub enum Error { #[error(display = "NetworkManager not detected")] - NetworkManagerNotDetected(#[error(cause)] dbus::Error), + NetworkManagerNotDetected(#[error(source)] dbus::Error), #[error(display = "NetworkManager is too old")] - TooOldNetworkManager(#[error(cause)] dbus::Error), + TooOldNetworkManager(#[error(source)] dbus::Error), #[error(display = "NetworkManager is not managing DNS")] NetworkManagerNotManagingDns, #[error(display = "Error while communicating over Dbus")] - Dbus(#[error(cause)] dbus::Error), + Dbus(#[error(source)] dbus::Error), #[error(display = "DNS is managed by systemd-resolved - NM can't enforce DNS globally")] SystemdResolved, diff --git a/talpid-core/src/dns/linux/resolvconf.rs b/talpid-core/src/dns/linux/resolvconf.rs index 14ce3107a1..d03499f930 100644 --- a/talpid-core/src/dns/linux/resolvconf.rs +++ b/talpid-core/src/dns/linux/resolvconf.rs @@ -18,7 +18,7 @@ pub enum Error { ResolvconfUsesResolved, #[error(display = "Failed to execute 'resolvconf' program")] - RunResolvconf(#[error(cause)] io::Error), + RunResolvconf(#[error(source)] io::Error), #[error(display = "Using 'resolvconf' to add a record failed: {}", stderr)] AddRecordError { stderr: String }, diff --git a/talpid-core/src/dns/linux/static_resolv_conf.rs b/talpid-core/src/dns/linux/static_resolv_conf.rs index b783c439de..70ff38ddce 100644 --- a/talpid-core/src/dns/linux/static_resolv_conf.rs +++ b/talpid-core/src/dns/linux/static_resolv_conf.rs @@ -18,19 +18,19 @@ pub type Result<T> = std::result::Result<T, Error>; #[derive(err_derive::Error, Debug)] pub enum Error { #[error(display = "Failed to watch /etc/resolv.conf for changes")] - WatchResolvConf(#[error(cause)] notify::Error), + WatchResolvConf(#[error(source)] notify::Error), #[error(display = "Failed to write to {}", _0)] - WriteResolvConf(&'static str, #[error(cause)] io::Error), + WriteResolvConf(&'static str, #[error(source)] io::Error), #[error(display = "Failed to read from {}", _0)] - ReadResolvConf(&'static str, #[error(cause)] io::Error), + ReadResolvConf(&'static str, #[error(source)] io::Error), #[error(display = "resolv.conf at {} could not be parsed", _0)] - ParseError(&'static str, #[error(cause)] resolv_conf::ParseError), + ParseError(&'static str, #[error(source)] resolv_conf::ParseError), #[error(display = "Failed to remove stale resolv.conf backup at {}", _0)] - RemoveBackup(&'static str, #[error(cause)] io::Error), + RemoveBackup(&'static str, #[error(source)] io::Error), } pub struct StaticResolvConf { diff --git a/talpid-core/src/dns/linux/systemd_resolved.rs b/talpid-core/src/dns/linux/systemd_resolved.rs index 1cd953bea6..f4466ac231 100644 --- a/talpid-core/src/dns/linux/systemd_resolved.rs +++ b/talpid-core/src/dns/linux/systemd_resolved.rs @@ -16,9 +16,10 @@ use talpid_types::ErrorExt as _; pub type Result<T> = std::result::Result<T, Error>; #[derive(err_derive::Error, Debug)] +#[error(no_from)] pub enum Error { #[error(display = "Failed to initialize a connection to D-Bus")] - ConnectDBus(#[error(cause)] dbus::Error), + ConnectDBus(#[error(source)] dbus::Error), #[error(display = "/etc/resolv.conf is not a symlink to Systemd resolved")] NotSymlinkedToResolvConf, @@ -27,31 +28,31 @@ pub enum Error { NoDnsPointsToResolved, #[error(display = "Systemd resolved not detected")] - NoSystemdResolved(#[error(cause)] dbus::Error), + NoSystemdResolved(#[error(source)] dbus::Error), #[error(display = "Failed to read Systemd resolved's resolv.conf")] - ReadResolvConfFailed(#[error(cause)] io::Error), + ReadResolvConfFailed(#[error(source)] io::Error), #[error(display = "Failed to parse Systemd resolved's resolv.conf")] - ParseResolvConfFailed(#[error(cause)] resolv_conf::ParseError), + ParseResolvConfFailed(#[error(source)] resolv_conf::ParseError), #[error(display = "Invalid network interface name")] - InvalidInterfaceName(#[error(cause)] crate::linux::IfaceIndexLookupError), + InvalidInterfaceName(#[error(source)] crate::linux::IfaceIndexLookupError), #[error(display = "Failed to find link interface in resolved manager")] - GetLinkError(#[error(cause)] Box<Error>), + GetLinkError(#[error(source)] Box<Error>), #[error(display = "Failed to configure DNS domains")] - SetDomainsError(#[error(cause)] dbus::Error), + SetDomainsError(#[error(source)] dbus::Error), #[error(display = "Failed to revert DNS settings of interface: {}", _0)] - RevertDnsError(String, #[error(cause)] dbus::Error), + RevertDnsError(String, #[error(source)] dbus::Error), #[error(display = "Failed to perform RPC call on D-Bus")] - DBusRpcError(#[error(cause)] dbus::Error), + DBusRpcError(#[error(source)] dbus::Error), #[error(display = "Failed to match the returned D-Bus object with expected type")] - MatchDBusTypeError(#[error(cause)] dbus::arg::TypeMismatchError), + MatchDBusTypeError(#[error(source)] dbus::arg::TypeMismatchError), } lazy_static! { diff --git a/talpid-core/src/firewall/linux.rs b/talpid-core/src/firewall/linux.rs index ef8d0025df..f33750bfc4 100644 --- a/talpid-core/src/firewall/linux.rs +++ b/talpid-core/src/firewall/linux.rs @@ -20,22 +20,23 @@ pub type Result<T> = std::result::Result<T, Error>; /// Errors that can happen when interacting with Linux netfilter. #[derive(err_derive::Error, Debug)] +#[error(no_from)] pub enum Error { /// Unable to open netlink socket to netfilter. #[error(display = "Unable to open netlink socket to netfilter")] - NetlinkOpenError(#[error(cause)] io::Error), + NetlinkOpenError(#[error(source)] io::Error), /// Unable to send netlink command to netfilter. #[error(display = "Unable to send netlink command to netfilter")] - NetlinkSendError(#[error(cause)] io::Error), + NetlinkSendError(#[error(source)] io::Error), /// Error while reading from netlink socket. #[error(display = "Error while reading from netlink socket")] - NetlinkRecvError(#[error(cause)] io::Error), + NetlinkRecvError(#[error(source)] io::Error), /// Error while processing an incoming netlink message. #[error(display = "Error while processing an incoming netlink message")] - ProcessNetlinkError(#[error(cause)] io::Error), + ProcessNetlinkError(#[error(source)] io::Error), /// Failed to verify that our tables are set. Probably means that /// it's the host that does not support nftables properly. @@ -47,7 +48,7 @@ pub enum Error { display = "Unable to translate network interface name \"{}\" into index", _0 )] - LookupIfaceIndexError(String, #[error(cause)] crate::linux::IfaceIndexLookupError), + LookupIfaceIndexError(String, #[error(source)] crate::linux::IfaceIndexLookupError), } lazy_static! { diff --git a/talpid-core/src/firewall/windows.rs b/talpid-core/src/firewall/windows.rs index 73dfb8c547..67b37713d2 100644 --- a/talpid-core/src/firewall/windows.rs +++ b/talpid-core/src/firewall/windows.rs @@ -38,7 +38,7 @@ pub enum Error { /// Failure to set TAP adapter metric #[error(display = "Unable to set TAP adapter metric")] - SetTapMetric(#[error(cause)] crate::winnet::Error), + SetTapMetric(#[error(source)] crate::winnet::Error), } const WINFW_TIMEOUT_SECONDS: u32 = 2; diff --git a/talpid-core/src/linux.rs b/talpid-core/src/linux.rs index c1e3a97e07..05655bf4be 100644 --- a/talpid-core/src/linux.rs +++ b/talpid-core/src/linux.rs @@ -21,7 +21,7 @@ pub fn iface_index(name: &str) -> Result<libc::c_uint, IfaceIndexLookupError> { #[derive(Debug, err_derive::Error)] pub enum IfaceIndexLookupError { #[error(display = "Invalid network interface name: {}", _0)] - InvalidInterfaceName(String, #[error(cause)] ffi::NulError), + InvalidInterfaceName(String, #[error(source)] ffi::NulError), #[error(display = "Failed to get index for interface {}", _0)] - InterfaceLookupError(String, #[error(cause)] io::Error), + InterfaceLookupError(String, #[error(source)] io::Error), } diff --git a/talpid-core/src/logging.rs b/talpid-core/src/logging.rs index b41e1a3ffc..3251a39799 100644 --- a/talpid-core/src/logging.rs +++ b/talpid-core/src/logging.rs @@ -3,7 +3,7 @@ use std::{fs, io, path::Path}; /// Unable to create new log file #[derive(err_derive::Error, Debug)] #[error(display = "Unable to create new log file")] -pub struct RotateLogError(#[error(cause)] io::Error); +pub struct RotateLogError(#[error(source)] io::Error); /// Create a new log file while backing up a previous version of it. /// diff --git a/talpid-core/src/network_interface.rs b/talpid-core/src/network_interface.rs index 201a2582c8..7d7e79b95a 100644 --- a/talpid-core/src/network_interface.rs +++ b/talpid-core/src/network_interface.rs @@ -8,26 +8,27 @@ use tun::{platform, Configuration, Device}; /// Errors that can happen when working with *nix tunnel interfaces. #[derive(err_derive::Error, Debug)] +#[error(no_from)] pub enum Error { /// Failed to set IP address #[error(display = "Failed to set IPv4 address")] - SetIpv4Error(#[error(cause)] tun::Error), + SetIpv4Error(#[error(source)] tun::Error), /// Failed to set IP address #[error(display = "Failed to set IPv6 address")] - SetIpv6Error(#[error(cause)] io::Error), + SetIpv6Error(#[error(source)] io::Error), /// Unable to open a tunnel device #[error(display = "Unable to open a tunnel device")] - CreateDeviceError(#[error(cause)] tun::Error), + CreateDeviceError(#[error(source)] tun::Error), /// Failed to apply async flags to tunnel device #[error(display = "Failed to apply async flags to tunnel device")] - SetDeviceAsyncError(#[error(cause)] nix::Error), + SetDeviceAsyncError(#[error(source)] nix::Error), /// Failed to enable/disable link device #[error(display = "Failed to enable/disable link device")] - ToggleDeviceError(#[error(cause)] tun::Error), + ToggleDeviceError(#[error(source)] tun::Error), } /// A trait for managing link devices diff --git a/talpid-core/src/offline/linux.rs b/talpid-core/src/offline/linux.rs index 726c598349..c38233d5e5 100644 --- a/talpid-core/src/offline/linux.rs +++ b/talpid-core/src/offline/linux.rs @@ -15,18 +15,19 @@ use talpid_types::ErrorExt; pub type Result<T> = std::result::Result<T, Error>; #[derive(err_derive::Error, Debug)] +#[error(no_from)] pub enum Error { #[error(display = "Failed to get list of IP links")] - GetLinksError(#[error(cause)] failure::Compat<rtnetlink::Error>), + GetLinksError(#[error(source)] failure::Compat<rtnetlink::Error>), #[error(display = "Failed to connect to netlink socket")] - NetlinkConnectionError(#[error(cause)] io::Error), + NetlinkConnectionError(#[error(source)] io::Error), #[error(display = "Failed to start listening on netlink socket")] - NetlinkBindError(#[error(cause)] io::Error), + NetlinkBindError(#[error(source)] io::Error), #[error(display = "Error while communicating on the netlink socket")] - NetlinkError(#[error(cause)] netlink_proto::Error), + NetlinkError(#[error(source)] netlink_proto::Error), #[error(display = "Error while processing netlink messages")] MonitorNetlinkError, diff --git a/talpid-core/src/offline/windows.rs b/talpid-core/src/offline/windows.rs index 7bd9007895..5c6029a268 100644 --- a/talpid-core/src/offline/windows.rs +++ b/talpid-core/src/offline/windows.rs @@ -47,7 +47,7 @@ const REQUEST_THREAD_SHUTDOWN: UINT = WM_USER + 1; #[derive(err_derive::Error, Debug)] pub enum Error { #[error(display = "Unable to create listener thread")] - ThreadCreationError(#[error(cause)] io::Error), + ThreadCreationError(#[error(source)] io::Error), #[error(display = "Failed to start connectivity monitor")] ConnectivityMonitorError, } diff --git a/talpid-core/src/ping_monitor/unix.rs b/talpid-core/src/ping_monitor/unix.rs index 5336bc7f2c..8a040d476d 100644 --- a/talpid-core/src/ping_monitor/unix.rs +++ b/talpid-core/src/ping_monitor/unix.rs @@ -11,7 +11,7 @@ use std::{ #[derive(err_derive::Error, Debug)] pub enum Error { #[error(display = "Failed to run ping command")] - PingError(#[error(cause)] io::Error), + PingError(#[error(source)] io::Error), #[error(display = "Ping timed out")] TimeoutError, diff --git a/talpid-core/src/ping_monitor/win.rs b/talpid-core/src/ping_monitor/win.rs index e98161fae6..f4540dddbd 100644 --- a/talpid-core/src/ping_monitor/win.rs +++ b/talpid-core/src/ping_monitor/win.rs @@ -19,18 +19,19 @@ use std::{ }; #[derive(err_derive::Error, Debug)] +#[error(no_from)] pub enum Error { /// Failed to open raw socket #[error(display = "Failed to open raw socket")] - OpenError(#[error(cause)] io::Error), + OpenError(#[error(source)] io::Error), /// Failed to read from raw socket #[error(display = "Failed to read from socket")] - ReadError(#[error(cause)] io::Error), + ReadError(#[error(source)] io::Error), /// Failed to write to raw socket #[error(display = "Failed to write to socket")] - WriteError(#[error(cause)] io::Error), + WriteError(#[error(source)] io::Error), #[error(display = "Timed out")] TimeoutError, diff --git a/talpid-core/src/routing/linux/change_listener.rs b/talpid-core/src/routing/linux/change_listener.rs index 56879a3361..1895a28761 100644 --- a/talpid-core/src/routing/linux/change_listener.rs +++ b/talpid-core/src/routing/linux/change_listener.rs @@ -14,23 +14,24 @@ use rtnetlink::constants::{ }; #[derive(err_derive::Error, Debug)] +#[error(no_from)] pub enum Error { #[error(display = "Netlink connection failed")] - NetlinkError(#[error(cause)] failure::Compat<rtnetlink::Error>), + NetlinkError(#[error(source)] failure::Compat<rtnetlink::Error>), #[error(display = "Netlink protocol error")] - NetlinkProtocolError(#[error(cause)] failure::Compat<netlink_proto::Error>), + NetlinkProtocolError(#[error(source)] failure::Compat<netlink_proto::Error>), #[error(display = "Failed to open a netlink connection")] - ConnectError(#[error(cause)] io::Error), + ConnectError(#[error(source)] io::Error), #[error(display = "Route without a valid node")] InvalidRoute, #[error(display = "Invalid length of byte buffer for IP address")] InvalidIpBytes, #[error(display = "Invalid network prefix")] - InvalidNetworkPrefix(#[error(cause)] ipnetwork::IpNetworkError), + InvalidNetworkPrefix(#[error(source)] ipnetwork::IpNetworkError), #[error(display = "Unknown device index - {}", _0)] UnknownDeviceIndex(u32), #[error(display = "Failed to bind netlink socket")] - BindError(#[error(cause)] io::Error), + BindError(#[error(source)] io::Error), #[error(display = "Netlink connection stopped sending messages")] NetlinkConnectionClosed, } diff --git a/talpid-core/src/routing/linux/mod.rs b/talpid-core/src/routing/linux/mod.rs index c39431acda..98fc929db7 100644 --- a/talpid-core/src/routing/linux/mod.rs +++ b/talpid-core/src/routing/linux/mod.rs @@ -28,7 +28,7 @@ pub enum Error { /// Error while running "ip route". #[error(display = "Error while running \"ip route\"")] - FailedToRunIp(#[error(cause)] io::Error), + FailedToRunIp(#[error(source)] io::Error), /// Invocation of `ip route` ended with a non-zero exit code #[error(display = "ip returend a non-zero exit code")] @@ -44,7 +44,7 @@ pub enum Error { /// Route table change stream failed. #[error(display = "Route change listener failed")] - ChangeListenerError(#[error(cause)] RouteChangeListenerError), + ChangeListenerError(#[error(source)] RouteChangeListenerError), /// Route table change stream failed. #[error(display = "Route change listener closed unexpectedly")] diff --git a/talpid-core/src/routing/macos.rs b/talpid-core/src/routing/macos.rs index 757fb56790..b00914a3c6 100644 --- a/talpid-core/src/routing/macos.rs +++ b/talpid-core/src/routing/macos.rs @@ -16,22 +16,23 @@ pub type Result<T> = std::result::Result<T, Error>; /// Errors that can happen in the macOS routing integration. #[derive(err_derive::Error, Debug)] +#[error(no_from)] pub enum Error { /// Failed to add route. #[error(display = "Failed to add route")] - FailedToAddRoute(#[error(cause)] io::Error), + FailedToAddRoute(#[error(source)] io::Error), /// Failed to remove route. #[error(display = "Failed to remove route")] - FailedToRemoveRoute(#[error(cause)] io::Error), + FailedToRemoveRoute(#[error(source)] io::Error), /// Error while running "ip route". #[error(display = "Error while running \"route get\"")] - FailedToRunRoute(#[error(cause)] io::Error), + FailedToRunRoute(#[error(source)] io::Error), /// Error while monitoring routes with `route -nv monitor` #[error(display = "Error while running \"route -nv monitor\"")] - FailedToMonitorRoutes(#[error(cause)] io::Error), + FailedToMonitorRoutes(#[error(source)] io::Error), /// No default route in "ip route" output. #[error(display = "No default route in \"ip route\" output")] diff --git a/talpid-core/src/routing/mod.rs b/talpid-core/src/routing/mod.rs index f6153fa41c..16ee5803ac 100644 --- a/talpid-core/src/routing/mod.rs +++ b/talpid-core/src/routing/mod.rs @@ -24,7 +24,7 @@ pub use imp::Error as PlatformError; pub enum Error { /// Platform sepcific error occured #[error(display = "Failed to create route manager")] - FailedToInitializeManager(#[error(cause)] imp::Error), + FailedToInitializeManager(#[error(source)] imp::Error), /// Failed to spawn route manager future #[error(display = "Failed to spawn route manager on the provided executor")] FailedToSpawnManager, diff --git a/talpid-core/src/tunnel/mod.rs b/talpid-core/src/tunnel/mod.rs index 8fe2f7eb66..d33182ddf3 100644 --- a/talpid-core/src/tunnel/mod.rs +++ b/talpid-core/src/tunnel/mod.rs @@ -30,7 +30,7 @@ const WIREGUARD_LOG_FILENAME: &str = "wireguard.log"; pub type Result<T> = std::result::Result<T, Error>; /// Errors that can occur in the [`TunnelMonitor`]. -#[derive(err_derive::Error, Debug, derive_more::From)] +#[derive(err_derive::Error, Debug)] pub enum Error { /// Tunnel can't have IPv6 enabled because the system has disabled IPv6 support. #[error(display = "Can't enable IPv6 on tunnel interface because IPv6 is disabled")] @@ -42,22 +42,22 @@ pub enum Error { /// Failed to rotate tunnel log file #[error(display = "Failed to rotate tunnel log file")] - RotateLogError(#[error(cause)] crate::logging::RotateLogError), + RotateLogError(#[error(source)] crate::logging::RotateLogError), /// Failure to build Wireguard configuration. #[cfg(any(target_os = "android", target_os = "linux", target_os = "macos"))] #[error(display = "Failed to configure Wireguard with the given parameters")] - WireguardConfigError(#[error(cause)] self::wireguard::config::Error), + WireguardConfigError(#[error(source)] self::wireguard::config::Error), /// There was an error listening for events from the OpenVPN tunnel #[cfg(not(target_os = "android"))] #[error(display = "Failed while listening for events from the OpenVPN tunnel")] - OpenVpnTunnelMonitoringError(#[error(cause)] openvpn::Error), + OpenVpnTunnelMonitoringError(#[error(source)] openvpn::Error), /// There was an error listening for events from the Wireguard tunnel #[cfg(any(target_os = "android", target_os = "linux", target_os = "macos"))] #[error(display = "Failed while listening for events from the Wireguard tunnel")] - WireguardTunnelMonitoringError(#[error(cause)] wireguard::Error), + WireguardTunnelMonitoringError(#[error(source)] wireguard::Error), } diff --git a/talpid-core/src/tunnel/openvpn.rs b/talpid-core/src/tunnel/openvpn.rs index 3edb3c2673..59d2d0f759 100644 --- a/talpid-core/src/tunnel/openvpn.rs +++ b/talpid-core/src/tunnel/openvpn.rs @@ -33,14 +33,15 @@ pub type Result<T> = std::result::Result<T, Error>; /// Errors that can happen when using the OpenVPN tunnel. #[derive(err_derive::Error, Debug)] +#[error(no_from)] pub enum Error { /// Unable to start, wait for or kill the OpenVPN process. #[error(display = "Error in OpenVPN process management: {}", _0)] - ChildProcessError(&'static str, #[error(cause)] io::Error), + ChildProcessError(&'static str, #[error(source)] io::Error), /// Unable to start or manage the IPC server listening for events from OpenVPN. #[error(display = "Unable to start or manage the event dispatcher IPC server")] - EventDispatcherError(#[error(cause)] talpid_ipc::Error), + EventDispatcherError(#[error(source)] talpid_ipc::Error), /// The OpenVPN event dispatcher exited unexpectedly #[error(display = "The OpenVPN event dispatcher exited unexpectedly")] @@ -63,7 +64,7 @@ pub enum Error { /// The IP routing program was not found. #[cfg(target_os = "linux")] #[error(display = "The IP routing program `ip` was not found")] - IpRouteNotFound(#[error(cause)] failure::Compat<which::Error>), + IpRouteNotFound(#[error(source)] failure::Compat<which::Error>), /// The OpenVPN binary was not found. #[error(display = "No OpenVPN binary found at {}", _0)] @@ -75,15 +76,15 @@ pub enum Error { /// Error while writing credentials to temporary file. #[error(display = "Error while writing credentials to temporary file")] - CredentialsWriteError(#[error(cause)] io::Error), + CredentialsWriteError(#[error(source)] io::Error), /// Failures related to the proxy service. #[error(display = "Unable to start the proxy service")] - StartProxyError(#[error(cause)] io::Error), + StartProxyError(#[error(source)] io::Error), /// Error while monitoring proxy service #[error(display = "Error while monitoring proxy service")] - MonitorProxyError(#[error(cause)] io::Error), + MonitorProxyError(#[error(source)] io::Error), /// The proxy exited unexpectedly #[error( @@ -95,7 +96,7 @@ pub enum Error { /// Failure in Windows syscall. #[cfg(windows)] #[error(display = "Failure in Windows syscall")] - WinnetError(#[error(cause)] crate::winnet::Error), + WinnetError(#[error(source)] crate::winnet::Error), } diff --git a/talpid-core/src/tunnel/tun_provider/unix.rs b/talpid-core/src/tunnel/tun_provider/unix.rs index 461e49a3b6..4e05505348 100644 --- a/talpid-core/src/tunnel/tun_provider/unix.rs +++ b/talpid-core/src/tunnel/tun_provider/unix.rs @@ -5,6 +5,7 @@ use talpid_types::BoxedError; /// Errors that can occur while setting up a tunnel device. #[derive(Debug, err_derive::Error)] +#[error(no_from)] pub enum Error { /// Failure to create a tunnel device. #[error(display = "Failed to create a tunnel device")] diff --git a/talpid-core/src/tunnel/wireguard/mod.rs b/talpid-core/src/tunnel/wireguard/mod.rs index 80d5a14187..3cb99c7d02 100644 --- a/talpid-core/src/tunnel/wireguard/mod.rs +++ b/talpid-core/src/tunnel/wireguard/mod.rs @@ -18,10 +18,11 @@ pub type Result<T> = std::result::Result<T, Error>; /// Errors that can happen in the Wireguard tunnel monitor. #[derive(err_derive::Error, Debug)] +#[error(no_from)] pub enum Error { /// Failed to setup a tunnel device. #[error(display = "Failed to create tunnel device")] - SetupTunnelDeviceError(#[error(cause)] BoxedError), + SetupTunnelDeviceError(#[error(source)] BoxedError), /// A recoverable error occurred while starting the wireguard tunnel /// @@ -44,25 +45,25 @@ pub enum Error { /// Failed to set up routing. #[error(display = "Failed to setup routing")] - SetupRoutingError(#[error(cause)] crate::routing::Error), + SetupRoutingError(#[error(source)] crate::routing::Error), /// Failed to move or craete a log file. #[error(display = "Failed to setup a logging file")] - PrepareLogFileError(#[error(cause)] io::Error), + PrepareLogFileError(#[error(source)] io::Error), /// Invalid tunnel interface name. #[error(display = "Invalid tunnel interface name")] - InterfaceNameError(#[error(cause)] std::ffi::NulError), + InterfaceNameError(#[error(source)] std::ffi::NulError), /// Failed to configure Wireguard sockets to bypass the tunnel. #[cfg(target_os = "android")] #[error(display = "Failed to configure Wireguard sockets to bypass the tunnel")] - BypassError(#[error(cause)] BoxedError), + BypassError(#[error(source)] BoxedError), /// Failed to duplicate tunnel file descriptor for wireguard-go #[cfg(any(target_os = "linux", target_os = "macos", target_os = "android"))] #[error(display = "Failed to duplicate tunnel file descriptor for wireguard-go")] - FdDuplicationError(#[error(cause)] nix::Error), + FdDuplicationError(#[error(source)] nix::Error), /// Pinging timed out. #[error(display = "Ping timed out")] diff --git a/talpid-core/src/tunnel_state_machine/mod.rs b/talpid-core/src/tunnel_state_machine/mod.rs index 41072596b8..66e564456f 100644 --- a/talpid-core/src/tunnel_state_machine/mod.rs +++ b/talpid-core/src/tunnel_state_machine/mod.rs @@ -40,19 +40,19 @@ use tokio_core::reactor::Core; pub enum Error { /// Unable to spawn offline state monitor #[error(display = "Unable to spawn offline state monitor")] - OfflineMonitorError(#[error(cause)] crate::offline::Error), + OfflineMonitorError(#[error(source)] crate::offline::Error), /// Failed to initialize the system firewall integration. #[error(display = "Failed to initialize the system firewall integration")] - InitFirewallError(#[error(cause)] crate::firewall::Error), + InitFirewallError(#[error(source)] crate::firewall::Error), /// Failed to initialize the system DNS manager and monitor. #[error(display = "Failed to initialize the system DNS manager and monitor")] - InitDnsMonitorError(#[error(cause)] crate::dns::Error), + InitDnsMonitorError(#[error(source)] crate::dns::Error), /// Failed to initialize tunnel state machine event loop executor #[error(display = "Failed to initialize tunnel state machine event loop executor")] - ReactorError(#[error(cause)] io::Error), + ReactorError(#[error(source)] io::Error), /// Failed to send state change event to listener #[error(display = "Failed to send state change event to listener")] diff --git a/talpid-core/src/winnet.rs b/talpid-core/src/winnet.rs index a95f69ae24..49a209fcbe 100644 --- a/talpid-core/src/winnet.rs +++ b/talpid-core/src/winnet.rs @@ -15,7 +15,7 @@ pub enum Error { /// Supplied interface alias is invalid. #[error(display = "Supplied interface alias is invalid")] - InvalidInterfaceAlias(#[error(cause)] widestring::NulError<u16>), + InvalidInterfaceAlias(#[error(source)] widestring::NulError<u16>), /// Failed to read IPv6 status on the TAP network interface. #[error(display = "Failed to read IPv6 status on the TAP network interface")] diff --git a/talpid-ipc/Cargo.toml b/talpid-ipc/Cargo.toml index 8ae8ae6181..e37eae4fd7 100644 --- a/talpid-ipc/Cargo.toml +++ b/talpid-ipc/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" edition = "2018" [dependencies] -err-derive = "0.1.5" +err-derive = "0.2.1" serde = "1.0" serde_json = "1.0" log = "0.4" diff --git a/talpid-ipc/src/lib.rs b/talpid-ipc/src/lib.rs index fd5cde7c63..1edb88fd42 100644 --- a/talpid-ipc/src/lib.rs +++ b/talpid-ipc/src/lib.rs @@ -21,18 +21,19 @@ use std::fmt; pub type IpcServerId = String; #[derive(err_derive::Error, Debug)] +#[error(no_from)] pub enum Error { #[error(display = "Unable to start IPC server")] - StartServerError(#[error(cause)] io::Error), + StartServerError(#[error(source)] io::Error), #[error(display = "IPC server thread panicked and never returned a start result")] ServerThreadPanicError, #[error(display = "Error in IPC server")] - IpcServerError(#[error(cause)] io::Error), + IpcServerError(#[error(source)] io::Error), #[error(display = "Unable to set permissions for IPC endpoint")] - PermissionsError(#[error(cause)] io::Error), + PermissionsError(#[error(source)] io::Error), } diff --git a/talpid-openvpn-plugin/Cargo.toml b/talpid-openvpn-plugin/Cargo.toml index e10cbb728c..18e8f34413 100644 --- a/talpid-openvpn-plugin/Cargo.toml +++ b/talpid-openvpn-plugin/Cargo.toml @@ -17,7 +17,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -err-derive = "0.1.5" +err-derive = "0.2.1" log = "0.4" env_logger = "0.7" jsonrpc-client-core = { git = "https://github.com/mullvad/jsonrpc-client-rs", rev = "68aac55b" } diff --git a/talpid-openvpn-plugin/src/lib.rs b/talpid-openvpn-plugin/src/lib.rs index c2080e294a..a26ca29982 100644 --- a/talpid-openvpn-plugin/src/lib.rs +++ b/talpid-openvpn-plugin/src/lib.rs @@ -17,27 +17,28 @@ use crate::processing::EventProcessor; #[derive(err_derive::Error, Debug)] +#[error(no_from)] pub enum Error { #[error(display = "No core server id given as first argument")] MissingCoreServerId, #[error(display = "Failed to send an event to daemon over the IPC channel")] - SendEvent(#[error(cause)] jsonrpc_client_core::Error), + SendEvent(#[error(source)] jsonrpc_client_core::Error), #[error(display = "Connection is shut down")] Shutdown, #[error(display = "Unable to start Tokio runtime")] - CreateRuntime(#[error(cause)] io::Error), + CreateRuntime(#[error(source)] io::Error), #[error(display = "Unable to create IPC transport")] - CreateTransport(#[error(cause)] io::Error), + CreateTransport(#[error(source)] io::Error), #[error(display = "Unable to parse environment variables from OpenVPN")] - ParseEnvFailed(#[error(cause)] std::str::Utf8Error), + ParseEnvFailed(#[error(source)] std::str::Utf8Error), #[error(display = "Unable to parse arguments from OpenVPN")] - ParseArgsFailed(#[error(cause)] std::str::Utf8Error), + ParseArgsFailed(#[error(source)] std::str::Utf8Error), } diff --git a/talpid-types/Cargo.toml b/talpid-types/Cargo.toml index a6146c3771..0412c8f501 100644 --- a/talpid-types/Cargo.toml +++ b/talpid-types/Cargo.toml @@ -12,4 +12,4 @@ ipnetwork = "0.15" base64 = "0.10" x25519-dalek = { version = "0.5", features = [ "std", "u64_backend" ], default-features = false } rand = "0.7" -err-derive = "0.1.5" +err-derive = "0.2.1" |
