Handle errors from icecast directory requests.

When a request fails, show an error dialog and don't attempt to parse results.
This commit is contained in:
Jim Broadus 2020-02-06 11:09:37 -08:00 committed by John Maguire
parent 2132310873
commit efb4f8a15a
1 changed files with 8 additions and 0 deletions

View File

@ -125,6 +125,14 @@ void IcecastService::DownloadDirectoryFinished(QNetworkReply* reply,
return;
}
if (reply->error() != QNetworkReply::NoError) {
app_->task_manager()->SetTaskFinished(task_id);
app_->AddError(tr("Failed to update icecast directory:\n%1")
.arg(reply->errorString()));
reply->deleteLater();
return;
}
QFuture<IcecastBackend::StationList> future =
QtConcurrent::run(this, &IcecastService::ParseDirectory, reply);
NewClosure(future, this, SLOT(ParseDirectoryFinished(