Skip to content

Commit

Permalink
replay: handle route not found error with user warning message (comma…
Browse files Browse the repository at this point in the history
…ai#32895)

handle 404
  • Loading branch information
deanlee committed Jul 3, 2024
1 parent 0fecfd6 commit 632c484
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/cabana/streams/replaystream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ bool ReplayStream::loadRoute(const QString &route, const QString &data_dir, uint
} else if (replay->lastRouteError() == RouteLoadError::NetworkError) {
QMessageBox::warning(nullptr, tr("Network Error"),
tr("Unable to load the route:\n\n %1.\n\nPlease check your network connection and try again.").arg(route));
} else if (replay->lastRouteError() == RouteLoadError::FileNotFound) {
QMessageBox::warning(nullptr, tr("Route Not Found"),
tr("The specified route could not be found:\n\n %1.\n\nPlease check the route name and try again.").arg(route));
} else {
QMessageBox::warning(nullptr, tr("Route Load Failed"), tr("Failed to load route: '%1'").arg(route));
}
Expand Down
5 changes: 5 additions & 0 deletions tools/replay/route.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ RouteIdentifier Route::parseRoute(const QString &str) {
}

bool Route::load() {
err_ = RouteLoadError::None;
if (route_.str.isEmpty() || (data_dir_.isEmpty() && route_.dongle_id.isEmpty())) {
rInfo("invalid route format");
return false;
Expand Down Expand Up @@ -76,6 +77,10 @@ bool Route::loadFromServer(int retries) {
rWarning(">> Unauthorized. Authenticate with tools/lib/auth.py <<");
err_ = RouteLoadError::AccessDenied;
return false;
} else if (err == QNetworkReply::ContentNotFoundError) {
rWarning("The specified route could not be found on the server.");
err_ = RouteLoadError::FileNotFound;
return false;
} else {
err_ = RouteLoadError::NetworkError;
}
Expand Down

0 comments on commit 632c484

Please sign in to comment.