Skip to content

Conversation

@louis-e
Copy link
Owner

@louis-e louis-e commented Jan 8, 2026

No description provided.

Copilot AI review requested due to automatic review settings January 8, 2026 22:33
@github-actions
Copy link

github-actions bot commented Jan 8, 2026

⏱️ Benchmark run finished in 0m 35s
🧠 Peak memory usage: 1006 MB

📈 Compared against baseline: 30s
🧮 Delta: 5s
🔢 Commit: eed73b0

⚠️ This PR worsens generation time.

📅 Last benchmark: 2026-01-08 22:35:34 UTC

You can retrigger the benchmark by commenting retrigger-benchmark.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request improves error handling for network connection issues by adding specific detection and messaging for connection failures (no internet) alongside the existing timeout handling. The changes ensure that proper error messages are propagated through the error chain rather than always returning the underlying reqwest error.

Key changes:

  • Added specific handling for connection errors using is_connect() method
  • Refactored error propagation to return meaningful error messages instead of raw reqwest errors
  • Simplified GUI error handling to use the propagated error messages directly

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/retrieve_data.rs Added connection error detection with specific error message; refactored error handling to return user-friendly messages for timeout, connection, and generic errors
src/gui.rs Simplified error handling to use the error string directly instead of wrapping it with additional context

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +39 to +43
let msg = "Request timed out. Try selecting a smaller area.";
eprintln!("{}", format!("Error! {msg}").red().bold());
Err(msg.into())
} else if e.is_connect() {
let msg = "No internet connection.";
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of emit_gui_error calls for timeout and connection errors creates an inconsistency with error handling elsewhere in this file. Other error paths in this file (such as lines 195, 199, and 209) still call emit_gui_error to notify the GUI. While the error is now properly returned and handled in gui.rs, removing these calls means the GUI notification happens later in the call chain. Consider whether this is the intended behavior, as it changes when and how error messages appear in the GUI.

Suggested change
let msg = "Request timed out. Try selecting a smaller area.";
eprintln!("{}", format!("Error! {msg}").red().bold());
Err(msg.into())
} else if e.is_connect() {
let msg = "No internet connection.";
let msg = "Request timed out. Try selecting a smaller area.";
emit_gui_error(msg.to_string());
eprintln!("{}", format!("Error! {msg}").red().bold());
Err(msg.into())
} else if e.is_connect() {
let msg = "No internet connection.";
emit_gui_error(msg.to_string());

Copilot uses AI. Check for mistakes.
eprintln!("{}", format!("Error! {msg}").red().bold());
Err(msg.into())
} else if e.is_connect() {
let msg = "No internet connection.";
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message "No internet connection." is potentially misleading. The reqwest is_connect() method returns true for various connection errors, not just "no internet." It can also indicate DNS failures, network routing issues, or the server being unreachable. Consider using a more accurate message like "Failed to connect to server. Please check your internet connection." to avoid misleading users when the issue might not be their internet connection.

Suggested change
let msg = "No internet connection.";
let msg = "Failed to connect to server. Please check your internet connection.";

Copilot uses AI. Check for mistakes.
@louis-e louis-e merged commit 07105f0 into main Jan 8, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants