Add clickable docs url on error (#806)

This commit is contained in:
Vladyslav Miachkov 2024-05-25 13:00:51 +03:00 committed by GitHub
parent a0c06048cd
commit b027fff103
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 173 additions and 104 deletions

View file

@ -8,7 +8,6 @@
#include "amnezia_application.h"
#include "configurators/wireguard_configurator.h"
#include "version.h"
#include "core/errorstrings.h"
namespace
{
@ -110,7 +109,7 @@ void ApiController::updateServerConfigFromApi(const QString &installationUuid, c
QByteArray ba = QByteArray::fromBase64(data.toUtf8(), QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals);
if (ba.isEmpty()) {
emit errorOccurred(errorString(ErrorCode::ApiConfigEmptyError));
emit errorOccurred(ErrorCode::ApiConfigEmptyError);
return;
}
@ -135,14 +134,14 @@ void ApiController::updateServerConfigFromApi(const QString &installationUuid, c
} else {
if (reply->error() == QNetworkReply::NetworkError::OperationCanceledError
|| reply->error() == QNetworkReply::NetworkError::TimeoutError) {
emit errorOccurred(errorString(ErrorCode::ApiConfigTimeoutError));
emit errorOccurred(ErrorCode::ApiConfigTimeoutError);
} else {
QString err = reply->errorString();
qDebug() << QString::fromUtf8(reply->readAll());
qDebug() << reply->error();
qDebug() << err;
qDebug() << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
emit errorOccurred(errorString(ErrorCode::ApiConfigDownloadError));
emit errorOccurred(ErrorCode::ApiConfigDownloadError);
}
}
@ -153,7 +152,7 @@ void ApiController::updateServerConfigFromApi(const QString &installationUuid, c
[this, reply](QNetworkReply::NetworkError error) { qDebug() << reply->errorString() << error; });
connect(reply, &QNetworkReply::sslErrors, [this, reply](const QList<QSslError> &errors) {
qDebug().noquote() << errors;
emit errorOccurred(errorString(ErrorCode::ApiConfigSslError));
emit errorOccurred(ErrorCode::ApiConfigSslError);
});
}
}

View file

@ -20,7 +20,7 @@ public slots:
void updateServerConfigFromApi(const QString &installationUuid, const int serverIndex, QJsonObject serverConfig);
signals:
void errorOccurred(const QString &errorMessage);
void errorOccurred(ErrorCode errorCode);
void configUpdated(const bool updateConfig, const QJsonObject &config, const int serverIndex);
private: