-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finished converting auxiliary commands to thiserror
- Loading branch information
nicholaslyang
authored and
nicholaslyang
committed
Oct 23, 2023
1 parent
b6a6458
commit 8348a64
Showing
15 changed files
with
223 additions
and
157 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1 @@ | ||
use anyhow::Result; | ||
use tracing::error; | ||
use turborepo_ui::{GREY, UI}; | ||
|
||
pub fn logout<F>(ui: &UI, mut set_token: F) -> Result<()> | ||
where | ||
F: FnMut() -> Result<()>, | ||
{ | ||
if let Err(err) = set_token() { | ||
error!("could not logout. Something went wrong: {}", err); | ||
return Err(err); | ||
} | ||
|
||
println!("{}", ui.apply(GREY.apply_to(">>> Logged out"))); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
mod login; | ||
mod logout; | ||
mod sso; | ||
|
||
pub use login::*; | ||
pub use logout::*; | ||
pub use sso::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
use std::{backtrace, io}; | ||
|
||
use thiserror::Error; | ||
use turbopath::AbsoluteSystemPathBuf; | ||
|
||
use crate::{ | ||
commands::{bin, prune}, | ||
daemon::DaemonError, | ||
rewrite_json::RewriteError, | ||
}; | ||
|
||
#[derive(Debug, Error)] | ||
pub enum Error { | ||
#[error("No command specified")] | ||
NoCommand(#[backtrace] backtrace::Backtrace), | ||
#[error("{0}")] | ||
Bin(#[from] bin::Error, #[backtrace] backtrace::Backtrace), | ||
#[error(transparent)] | ||
Path(#[from] turbopath::Error), | ||
#[error("at least one task must be specified")] | ||
NoTasks(#[backtrace] backtrace::Backtrace), | ||
#[error(transparent)] | ||
Config(#[from] crate::config::Error), | ||
#[error(transparent)] | ||
ChromeTracing(#[from] crate::tracing::Error), | ||
#[error("Encountered an IO error while attempting to read {config_path}: {error}")] | ||
FailedToReadConfig { | ||
config_path: AbsoluteSystemPathBuf, | ||
error: io::Error, | ||
}, | ||
#[error("Encountered an IO error while attempting to set {config_path}: {error}")] | ||
FailedToSetConfig { | ||
config_path: AbsoluteSystemPathBuf, | ||
error: io::Error, | ||
}, | ||
#[error(transparent)] | ||
Rewrite(#[from] RewriteError), | ||
#[error(transparent)] | ||
Auth(#[from] turborepo_auth::Error), | ||
#[error(transparent)] | ||
Daemon(#[from] DaemonError), | ||
#[error(transparent)] | ||
Prune(#[from] prune::Error), | ||
// Temporary to prevent having to move all of the errors from anyhow to thiserror at once. | ||
#[error(transparent)] | ||
Anyhow(#[from] anyhow::Error), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.