summaryrefslogtreecommitdiffhomepage
path: root/mullvad-cli/src/cmds/reset.rs
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2021-01-26 12:41:46 +0100
committerDavid Lönnhager <david.l@mullvad.net>2021-01-28 13:22:29 +0100
commit6331f5eac893fc6be73033f185be331fbb54898a (patch)
tree6859731c41169fadaf947d77768a3b289c764fd8 /mullvad-cli/src/cmds/reset.rs
parent70a51c45f113935c781a218ba7dd9a2d35972773 (diff)
downloadmullvadvpn-6331f5eac893fc6be73033f185be331fbb54898a.tar.xz
mullvadvpn-6331f5eac893fc6be73033f185be331fbb54898a.zip
Forward factory reset errors to frontend
Diffstat (limited to 'mullvad-cli/src/cmds/reset.rs')
-rw-r--r--mullvad-cli/src/cmds/reset.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/mullvad-cli/src/cmds/reset.rs b/mullvad-cli/src/cmds/reset.rs
index bb10a3f0fe..1be34a0ab0 100644
--- a/mullvad-cli/src/cmds/reset.rs
+++ b/mullvad-cli/src/cmds/reset.rs
@@ -1,4 +1,4 @@
-use crate::{new_rpc_client, Command, Result};
+use crate::{new_rpc_client, Command, Error, Result};
use std::io::stdin;
pub struct Reset;
@@ -15,12 +15,11 @@ impl Command for Reset {
async fn run(&self, _: &clap::ArgMatches<'_>) -> Result<()> {
let mut rpc = new_rpc_client().await?;
if Self::receive_confirmation() {
- if rpc.factory_reset(()).await.is_err() {
- eprintln!("FAILED TO PERFORM FACTORY RESET");
- } else {
- #[cfg(target_os = "linux")]
- println!("If you're running systemd, to remove all logs, you must use journalctl");
- }
+ rpc.factory_reset(())
+ .await
+ .map_err(|error| Error::RpcFailedExt("FAILED TO PERFORM FACTORY RESET", error))?;
+ #[cfg(target_os = "linux")]
+ println!("If you're running systemd, to remove all logs, you must use journalctl");
}
Ok(())
}