diff options
author | Daniel Mueller <deso@posteo.net> | 2020-08-28 18:44:45 -0700 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2020-08-28 18:44:45 -0700 |
commit | b605614e5b3dab828e4f33c300836deab421be34 (patch) | |
tree | 5d0f250f0ae24ba595b983c79fa9bad9045a650b /src/arg_util.rs | |
parent | 11344455b0629f989d8b78c27ed0e7d654fc74ef (diff) | |
download | nitrocli-b605614e5b3dab828e4f33c300836deab421be34.tar.gz nitrocli-b605614e5b3dab828e4f33c300836deab421be34.tar.bz2 |
Use anyhow for error handling
This patch changes our error handling approach from the ground up:
instead of having a globally used Error enum that contains variants for
all possible errors, we now use anyhow's Error type. This approach is
more dynamic (and not statically typed), but it allows for more fine
grained error messages and overall more user-friendly error reporting.
Overall it also is a net simplification. While we have one dynamic cast
now, in order to be able to handle erroneous password/PIN entries
correctly, that is considered a reasonable compromise.
Diffstat (limited to 'src/arg_util.rs')
-rw-r--r-- | src/arg_util.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/arg_util.rs b/src/arg_util.rs index 3a4c001..be361c7 100644 --- a/src/arg_util.rs +++ b/src/arg_util.rs @@ -50,7 +50,7 @@ macro_rules! Command { pub fn execute( self, ctx: &mut crate::ExecCtx<'_>, - ) -> crate::Result<()> { + ) -> anyhow::Result<()> { match self { $( $name::$var$((tr!(args, $inner)))? => $exec(ctx $(,tr!(args, $inner))?), |