diff options
| author | David Lönnhager <david.l@mullvad.net> | 2021-01-28 19:03:33 +0100 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2021-07-02 09:54:19 +0200 |
| commit | f7a2e49ab032a70c0ce18ff359edb15f0668ec4c (patch) | |
| tree | d0a69843d11dffb33a4ef217d1c400e13b90aa45 | |
| parent | f9f928b146fca041fc4dcb410d3a4621f5b0863e (diff) | |
| download | mullvadvpn-f7a2e49ab032a70c0ce18ff359edb15f0668ec4c.tar.xz mullvadvpn-f7a2e49ab032a70c0ce18ff359edb15f0668ec4c.zip | |
Improve split tunneling related gRPC statuses
| -rw-r--r-- | mullvad-daemon/src/management_interface.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/mullvad-daemon/src/management_interface.rs b/mullvad-daemon/src/management_interface.rs index cf5903d714..5bf5e3c61c 100644 --- a/mullvad-daemon/src/management_interface.rs +++ b/mullvad-daemon/src/management_interface.rs @@ -902,6 +902,8 @@ fn map_daemon_error(error: crate::Error) -> Status { match error { DaemonError::RestError(error) => map_rest_error(error), DaemonError::SettingsError(error) => map_settings_error(error), + #[cfg(windows)] + DaemonError::SplitTunnelError(error) => map_split_tunnel_error(error), DaemonError::AccountHistory(error) => map_account_history_error(error), DaemonError::NoAccountToken | DaemonError::NoAccountTokenHistory => { Status::unauthenticated(error.to_string()) @@ -910,6 +912,23 @@ fn map_daemon_error(error: crate::Error) -> Status { } } +#[cfg(windows)] +/// Converts [`talpid_core::split_tunnel::Error`] into a tonic status. +fn map_split_tunnel_error(error: talpid_core::split_tunnel::Error) -> Status { + use talpid_core::split_tunnel::Error; + + match &error { + Error::RegisterIps(io_error) | Error::SetConfiguration(io_error) => { + if io_error.kind() == std::io::ErrorKind::NotFound { + Status::not_found(format!("{}: {}", error, io_error)) + } else { + Status::unknown(error.to_string()) + } + } + _ => Status::unknown(error.to_string()), + } +} + /// Converts a REST API voucher error into a tonic status. fn map_rest_voucher_error(error: RestError) -> Status { match error { |
