fix(auth): deduplicate error popups, clear keyring errors
This commit is contained in:
1 parent
d3efaca167
commit
3584f2c7cf
3 files changed
+7
-10
No files matched your search
+6
-1
@@ -298,7 +298,12 @@ pub async fn refresh_and_get_token(account: &Account) -> Result<String, String>
|
||||
match account.account_type {
|
||||
AccountType::Offline => Ok("0".to_string()),
|
||||
AccountType::Microsoft => {
|
||||
let refresh = get_refresh_token(&account.uuid)?;
|
||||
let refresh = get_refresh_token(&account.uuid).map_err(|_| {
|
||||
format!(
|
||||
"No saved credentials for '{}'. Please remove and re-add the account.",
|
||||
account.username
|
||||
)
|
||||
})?;
|
||||
|
||||
let oauth_client = BasicClient::new(ClientId::new(CLIENT_ID.to_string()))
|
||||
.set_auth_uri(
|
||||
|
||||
@@ -244,7 +244,6 @@ pub async fn launch(
|
||||
match crate::auth::refresh_and_get_token(acc).await {
|
||||
Ok(t) => t,
|
||||
Err(e) => {
|
||||
tracing::error!("Token refresh failed: {e}");
|
||||
return Err(LaunchError::Auth(format!(
|
||||
"Authentication failed: {e}"
|
||||
)));
|
||||
|
||||
+1
-8
@@ -531,7 +531,6 @@ impl App {
|
||||
fn spawn_launch(&self, instance: crate::instance::InstanceConfig) {
|
||||
use crate::instance::launch;
|
||||
use crate::running;
|
||||
use crate::tui::error_buffer;
|
||||
|
||||
let instances_dir = self.instance_manager.instances_dir.clone();
|
||||
let meta_dir = self.instance_manager.meta_dir.clone();
|
||||
@@ -540,14 +539,8 @@ impl App {
|
||||
match launch::launch(&instance, &instances_dir, &meta_dir).await {
|
||||
Ok(()) => {}
|
||||
Err(e) => {
|
||||
tracing::error!("Launch failed for '{}': {}", instance.name, e);
|
||||
tracing::error!("Failed to launch '{}': {}", instance.name, e);
|
||||
running::remove(&instance.name);
|
||||
error_buffer::push_error(error_buffer::ErrorEvent {
|
||||
id: 0,
|
||||
level: tracing::Level::ERROR,
|
||||
message: format!("Failed to launch '{}': {}", instance.name, e),
|
||||
pushed_at: std::time::Instant::now(),
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user