mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-06 14:16:39 +08:00
replay: handle route not found error with user warning message (#32895)
handle 404 old-commit-hash: 632c484dd5e1f18a6c63b7505bd773d448b86661
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user