Migrate from failure to anyhow/thiserror (#273)

This commit is contained in:
Roey Darwish Dror
2019-12-11 23:05:38 +02:00
committed by GitHub
parent 1ea9b91e11
commit ba516aa1dd
22 changed files with 259 additions and 335 deletions

View File

@@ -1,9 +1,9 @@
use crate::error::Error;
#[cfg(windows)]
use crate::error::ErrorKind;
use crate::error::SkipStep;
use crate::executor::{CommandExt, RunType};
use crate::terminal::{is_dumb, print_separator};
use crate::utils::{require_option, which, PathExt};
use anyhow::Result;
use std::path::PathBuf;
use std::process::Command;
@@ -53,7 +53,7 @@ impl Powershell {
self.profile.as_ref()
}
pub fn update_modules(&self, run_type: RunType) -> Result<(), Error> {
pub fn update_modules(&self, run_type: RunType) -> Result<()> {
let powershell = require_option(self.path.as_ref())?;
print_separator("Powershell Modules Update");
@@ -65,11 +65,11 @@ impl Powershell {
}
#[cfg(windows)]
pub fn windows_update(&self, run_type: RunType) -> Result<(), Error> {
pub fn windows_update(&self, run_type: RunType) -> Result<()> {
let powershell = require_option(self.path.as_ref())?;
if !Self::has_module(&powershell, "PSWindowsUpdate") {
return Err(ErrorKind::SkipStep.into());
return Err(SkipStep.into());
}
print_separator("Windows Update");