summaryrefslogtreecommitdiffhomepage
path: root/mullvad-exclude
diff options
context:
space:
mode:
authorJoakim Hulthe <joakim@hulthe.net>2024-02-26 14:24:15 +0100
committerDavid Lönnhager <david.l@mullvad.net>2024-02-27 10:38:19 +0100
commita6d3578d256349ffe74b7c6a7a80ac2d70b7f68e (patch)
tree92d6bfab07a4d7d8d88fce7680ffd8278c37d4ce /mullvad-exclude
parent0a4915b113263f8353663e4fc07297d2862f2bc0 (diff)
downloadmullvadvpn-a6d3578d256349ffe74b7c6a7a80ac2d70b7f68e.tar.xz
mullvadvpn-a6d3578d256349ffe74b7c6a7a80ac2d70b7f68e.zip
Replace err_derive with thiserror
`err_derive` is unmaintained and will probably stop working with rust edition 2024. `thiserror` is almost a drop-in replacement. This commit simply replaces all occurences of `derive(err_derive::Error)` with `derive(thiserror::Error)` and fixes the attributes, but the Error and Display impls should be identical.
Diffstat (limited to 'mullvad-exclude')
-rw-r--r--mullvad-exclude/Cargo.toml2
-rw-r--r--mullvad-exclude/src/main.rs31
2 files changed, 16 insertions, 17 deletions
diff --git a/mullvad-exclude/Cargo.toml b/mullvad-exclude/Cargo.toml
index 127fa7d1bb..e758aae58e 100644
--- a/mullvad-exclude/Cargo.toml
+++ b/mullvad-exclude/Cargo.toml
@@ -12,5 +12,5 @@ workspace = true
[target.'cfg(target_os = "linux")'.dependencies]
nix = "0.23"
-err-derive = { workspace = true }
+thiserror = { workspace = true }
talpid-types = { path = "../talpid-types" }
diff --git a/mullvad-exclude/src/main.rs b/mullvad-exclude/src/main.rs
index 9135a6d292..238446875d 100644
--- a/mullvad-exclude/src/main.rs
+++ b/mullvad-exclude/src/main.rs
@@ -20,31 +20,30 @@ use talpid_types::cgroup::{find_net_cls_mount, SPLIT_TUNNEL_CGROUP_NAME};
const PROGRAM_NAME: &str = "mullvad-exclude";
#[cfg(target_os = "linux")]
-#[derive(err_derive::Error, Debug)]
-#[error(no_from)]
+#[derive(thiserror::Error, Debug)]
enum Error {
- #[error(display = "Invalid arguments")]
+ #[error("Invalid arguments")]
InvalidArguments,
- #[error(display = "Cannot set the cgroup")]
- AddProcToCGroup(#[error(source)] io::Error),
+ #[error("Cannot set the cgroup")]
+ AddProcToCGroup(#[source] io::Error),
- #[error(display = "Failed to drop root user privileges for the process")]
- DropRootUid(#[error(source)] nix::Error),
+ #[error("Failed to drop root user privileges for the process")]
+ DropRootUid(#[source] nix::Error),
- #[error(display = "Failed to drop root group privileges for the process")]
- DropRootGid(#[error(source)] nix::Error),
+ #[error("Failed to drop root group privileges for the process")]
+ DropRootGid(#[source] nix::Error),
- #[error(display = "Failed to launch the process")]
- Exec(#[error(source)] nix::Error),
+ #[error("Failed to launch the process")]
+ Exec(#[source] nix::Error),
- #[error(display = "An argument contains interior nul bytes")]
- ArgumentNul(#[error(source)] NulError),
+ #[error("An argument contains interior nul bytes")]
+ ArgumentNul(#[source] NulError),
- #[error(display = "Failed to find net_cls controller")]
- FindNetClsController(#[error(source)] io::Error),
+ #[error("Failed to find net_cls controller")]
+ FindNetClsController(#[source] io::Error),
- #[error(display = "No net_cls controller")]
+ #[error("No net_cls controller")]
NoNetClsController,
}