replay: handle route not found error with user warning message (#32895)

handle 404
pull/32887/head^2
Dean Lee 11 months ago committed by GitHub
parent 0fecfd6c45
commit 632c484dd5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      tools/cabana/streams/replaystream.cc
  2. 5
      tools/replay/route.cc

@ -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));
}

@ -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;
@ -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;
}

Loading…
Cancel
Save