mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2024-11-25 10:25:17 +00:00
Loader: catch exceptions and reemit them as errors
This reduces application crashes when an invalid JSON response has been returned.
This commit is contained in:
parent
7f39da0b95
commit
5a24bdee59
|
@ -193,6 +193,7 @@ private:
|
|||
void onRequestFinished() {
|
||||
if (m_reply->error() != QNetworkReply::NoError) {
|
||||
m_reply->deleteLater();
|
||||
m_parsedWatcher.cancel();
|
||||
//: An HTTP has occurred. First argument is replaced by QNetworkReply->errorString()
|
||||
this->stopWithError(QStringLiteral("HTTP error: %1").arg(m_reply->errorString()));
|
||||
}
|
||||
|
@ -223,11 +224,15 @@ private:
|
|||
}
|
||||
|
||||
void onResponseParsed() {
|
||||
Q_ASSERT(m_parsedWatcher.isFinished());
|
||||
if (m_parsedWatcher.result().has_value()) {
|
||||
R result = m_parsedWatcher.result().value();
|
||||
this->m_result = result;
|
||||
this->m_isRunning = false;
|
||||
emit this->ready();
|
||||
try {
|
||||
this->m_result = m_parsedWatcher.result().value();
|
||||
this->m_isRunning = false;
|
||||
emit this->ready();
|
||||
} catch (QException &e) {
|
||||
this->stopWithError(e.what());
|
||||
}
|
||||
} else {
|
||||
this->m_isRunning = false;
|
||||
}
|
||||
|
|
|
@ -361,6 +361,7 @@ void PlaybackManager::onItemUrlReceived(const QString &itemId, const QUrl &url,
|
|||
void PlaybackManager::onItemErrorReceived(const QString &itemId, const QString &errorString) {
|
||||
Q_UNUSED(itemId)
|
||||
Q_UNUSED(errorString)
|
||||
qWarning() << "Error while fetching streaming url for " << itemId << ": " << errorString;
|
||||
}
|
||||
|
||||
} // NS ViewModel
|
||||
|
|
Loading…
Reference in a new issue