Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dirs = "6.0.0"

keyring-lib = { version = "1.0.3", features = ["tokio"] }
ratatui = "0.30.2"
reqwest = { version = "0.13.4", default-features = false, features = ["json"] }
reqwest = { version = "0.13.4", default-features = false, features = ["json", "rustls"] }
serde = { version = "1", features = ["derive"] }
tokio = { version = "1.52.3", features = ["full"] }
serde_json = "1.0.150"
Expand Down
5 changes: 4 additions & 1 deletion src/api/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ impl Auth {
let err_msg = e.to_string();
if err_msg.contains("401") {
"Invalid token. Please check your session token and try again.".to_string()
} else {
} else if err_msg.contains("API GET request") {
err_msg
} else {
"Could not connect to the server. Please check your internet connection."
.to_string()
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl App {
client = authenticated_client;
AppState::LoggedIn
}
Err(e) => AppState::Error(format!("Stored token is invalid: {}", e)),
Err(e) => AppState::Error(e),
}
} else {
AppState::InputToken
Expand Down
18 changes: 12 additions & 6 deletions src/ui/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ use ratatui::{
};

pub fn render(f: &mut Frame, message: &str) {
let error_text = format!("CRITICAL SYSTEM ERROR:\n\n{message}\n\nPress any key to return...");
let title = if message.contains("keyring") || message.contains("Keyring") {
" Keyring Error "
} else if message.contains("connect") || message.contains("internet") {
" Connection Error "
} else if message.contains("Invalid token") {
" Authentication Error "
} else {
" Error "
};

let error_text = format!("{message}\n\nPress any key to return...");
let error_msg = Paragraph::new(error_text)
.style(Style::default().fg(Color::Red))
.block(
Block::default()
.title(" Keyring Failure ")
.borders(Borders::ALL),
);
.block(Block::default().title(title).borders(Borders::ALL));
f.render_widget(error_msg, f.area());
}
Loading