Add error handling/message for url handler
This commit is contained in:
@@ -911,7 +911,7 @@ void TidalService::Error(QString error, QVariant debug) {
|
||||
CheckFinish();
|
||||
}
|
||||
if (!stream_request_url_.isEmpty() && !login_sent_) {
|
||||
emit StreamURLFinished(stream_request_url_, Song::FileType_Stream);
|
||||
emit StreamURLFinished(stream_request_url_, Song::FileType_Stream, error);
|
||||
stream_request_url_ = QUrl();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class TidalService : public InternetService {
|
||||
void ProgressSetMaximum(int max);
|
||||
void UpdateProgress(int max);
|
||||
void GetStreamURLFinished(QNetworkReply *reply, const QUrl url);
|
||||
void StreamURLFinished(const QUrl url, const Song::FileType);
|
||||
void StreamURLFinished(const QUrl url, const Song::FileType, QString error = QString());
|
||||
|
||||
public slots:
|
||||
void ShowConfig();
|
||||
|
||||
@@ -33,7 +33,7 @@ TidalUrlHandler::TidalUrlHandler(
|
||||
Application *app, TidalService *service)
|
||||
: UrlHandler(service), app_(app), service_(service), task_id_(-1) {
|
||||
|
||||
connect(service, SIGNAL(StreamURLFinished(QUrl, Song::FileType)), this, SLOT(GetStreamURLFinished(QUrl, Song::FileType)));
|
||||
connect(service, SIGNAL(StreamURLFinished(QUrl, Song::FileType, QString)), this, SLOT(GetStreamURLFinished(QUrl, Song::FileType, QString)));
|
||||
|
||||
}
|
||||
|
||||
@@ -49,11 +49,14 @@ UrlHandler::LoadResult TidalUrlHandler::StartLoading(const QUrl &url) {
|
||||
|
||||
}
|
||||
|
||||
void TidalUrlHandler::GetStreamURLFinished(QUrl url, Song::FileType filetype) {
|
||||
void TidalUrlHandler::GetStreamURLFinished(QUrl url, Song::FileType filetype, QString error) {
|
||||
|
||||
if (task_id_ == -1) return;
|
||||
CancelTask();
|
||||
emit AsyncLoadComplete(LoadResult(last_original_url_, LoadResult::TrackAvailable, url, filetype));
|
||||
if (error.isEmpty())
|
||||
emit AsyncLoadComplete(LoadResult(last_original_url_, LoadResult::TrackAvailable, url, filetype));
|
||||
else
|
||||
emit AsyncLoadComplete(LoadResult(last_original_url_, LoadResult::Error, url, filetype, -1, error));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class TidalUrlHandler : public UrlHandler {
|
||||
void CancelTask();
|
||||
|
||||
private slots:
|
||||
void GetStreamURLFinished(QUrl url, Song::FileType filetype);
|
||||
void GetStreamURLFinished(QUrl url, Song::FileType filetype, QString error = QString());
|
||||
|
||||
private:
|
||||
Application *app_;
|
||||
|
||||
Reference in New Issue
Block a user