mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 15:37:23 +00:00
more correct error checking
This commit is contained in:
parent
18c993c0d5
commit
f3f9239984
@ -123,13 +123,19 @@ void AWDataEngineAggregator::createQueuedConnection()
|
||||
sources = m_dataEngines[dataEngine]->sources();
|
||||
// reconnect sources
|
||||
for (auto source : sources) {
|
||||
Plasma::DataContainer *container =m_dataEngines[dataEngine]->containerForSource(source);
|
||||
Plasma::DataContainer *container
|
||||
= m_dataEngines[dataEngine]->containerForSource(source);
|
||||
// disconnect old connections first
|
||||
disconnect(container, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
|
||||
parent(), SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
|
||||
disconnect(container,
|
||||
SIGNAL(dataUpdated(QString, Plasma::DataEngine::Data)),
|
||||
parent(),
|
||||
SLOT(dataUpdated(QString, Plasma::DataEngine::Data)));
|
||||
// and now reconnect with Qt::QueuedConnection type
|
||||
connect(container, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
|
||||
parent(), SLOT(dataUpdated(QString,Plasma::DataEngine::Data)), Qt::QueuedConnection);
|
||||
connect(container,
|
||||
SIGNAL(dataUpdated(QString, Plasma::DataEngine::Data)),
|
||||
parent(),
|
||||
SLOT(dataUpdated(QString, Plasma::DataEngine::Data)),
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
#include <QSettings>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
||||
@ -145,13 +144,16 @@ void AWUpdateHelper::userReplyOnUpdates(QAbstractButton *button)
|
||||
void AWUpdateHelper::versionReplyRecieved(QNetworkReply *reply,
|
||||
const bool showAnyway)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Return code" << reply->error() << "with message"
|
||||
<< reply->errorString() << "and show anyway" << showAnyway;
|
||||
qCDebug(LOG_AW) << "Show message anyway" << showAnyway;
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
qCWarning(LOG_AW) << "An error occurs" << reply->error()
|
||||
<< "with message" << reply->errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonParseError error;
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(reply->readAll(), &error);
|
||||
if ((reply->error() != QNetworkReply::NoError)
|
||||
|| (error.error != QJsonParseError::NoError)) {
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qCWarning(LOG_AW) << "Parse error" << error.errorString();
|
||||
return;
|
||||
}
|
||||
|
@ -188,15 +188,17 @@ void ExtQuotes::writeConfiguration() const
|
||||
|
||||
void ExtQuotes::quotesReplyReceived(QNetworkReply *reply)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Return code" << reply->error() << "with message"
|
||||
<< reply->errorString();
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
qCWarning(LOG_AW) << "An error occurs" << reply->error()
|
||||
<< "with message" << reply->errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
m_isRunning = false;
|
||||
QJsonParseError error;
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(reply->readAll(), &error);
|
||||
reply->deleteLater();
|
||||
if ((reply->error() != QNetworkReply::NoError)
|
||||
|| (error.error != QJsonParseError::NoError)) {
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qCWarning(LOG_LIB) << "Parse error" << error.errorString();
|
||||
return;
|
||||
}
|
||||
|
@ -336,15 +336,17 @@ void ExtWeather::writeConfiguration() const
|
||||
|
||||
void ExtWeather::weatherReplyReceived(QNetworkReply *reply)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Return code" << reply->error() << "with message"
|
||||
<< reply->errorString();
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
qCWarning(LOG_AW) << "An error occurs" << reply->error()
|
||||
<< "with message" << reply->errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
m_isRunning = false;
|
||||
QJsonParseError error;
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(reply->readAll(), &error);
|
||||
reply->deleteLater();
|
||||
if ((reply->error() != QNetworkReply::NoError)
|
||||
|| (error.error != QJsonParseError::NoError)) {
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qCWarning(LOG_LIB) << "Parse error" << error.errorString();
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user