forked from qt-creator/qt-creator
Axivion: Show error messages on CredentialQuery errors
Use more writeDisrupting() for logging Axivion errors. Don't translate "Axivion". Change-Id: Ic04ff0afe66d79be3d319b16948f7861225e8927 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -205,7 +205,7 @@ class AxivionTextMark : public TextMark
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AxivionTextMark(const FilePath &filePath, const Dto::LineMarkerDto &issue)
|
AxivionTextMark(const FilePath &filePath, const Dto::LineMarkerDto &issue)
|
||||||
: TextMark(filePath, issue.startLine, {Tr::tr("Axivion"), s_axivionTextMarkId})
|
: TextMark(filePath, issue.startLine, {QString("Axivion"), s_axivionTextMarkId})
|
||||||
{
|
{
|
||||||
const QString markText = issue.description;
|
const QString markText = issue.description;
|
||||||
const QString id = issue.kind + QString::number(issue.id.value_or(-1));
|
const QString id = issue.kind + QString::number(issue.id.value_or(-1));
|
||||||
@@ -308,7 +308,7 @@ static QUrl urlForProject(const QString &projectName)
|
|||||||
QString dashboard = settings().server.dashboard;
|
QString dashboard = settings().server.dashboard;
|
||||||
if (!dashboard.endsWith(QLatin1Char('/')))
|
if (!dashboard.endsWith(QLatin1Char('/')))
|
||||||
dashboard += QLatin1Char('/');
|
dashboard += QLatin1Char('/');
|
||||||
return QUrl(dashboard).resolved(QStringLiteral("api/projects/")).resolved(projectName);
|
return QUrl(dashboard).resolved(QString("api/projects/")).resolved(projectName);
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr int httpStatusCodeOk = 200;
|
static constexpr int httpStatusCodeOk = 200;
|
||||||
@@ -428,8 +428,7 @@ static Group dtoRecipe(const Storage<DtoStorageType<DtoType>> &dtoStorage)
|
|||||||
}
|
}
|
||||||
return NetworkError(reply->url(), error, reply->errorString());
|
return NetworkError(reply->url(), error, reply->errorString());
|
||||||
};
|
};
|
||||||
|
MessageManager::writeDisrupting(QString("Axivion: %1").arg(getError().message()));
|
||||||
MessageManager::writeFlashing(QStringLiteral("Axivion: %1").arg(getError().message()));
|
|
||||||
return DoneResult::Error;
|
return DoneResult::Error;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -493,7 +492,8 @@ static Group authorizationRecipe()
|
|||||||
const auto onGetCredentialDone = [](const CredentialQuery &credential, DoneWith result) {
|
const auto onGetCredentialDone = [](const CredentialQuery &credential, DoneWith result) {
|
||||||
if (result == DoneWith::Success)
|
if (result == DoneWith::Success)
|
||||||
dd->m_apiToken = credential.data();
|
dd->m_apiToken = credential.data();
|
||||||
// TODO: Show the message about keystore error and info that we can't authorize without it.
|
else
|
||||||
|
MessageManager::writeDisrupting(QString("Axivion: %1").arg(credential.errorString()));
|
||||||
};
|
};
|
||||||
|
|
||||||
const Storage<QString> passwordStorage;
|
const Storage<QString> passwordStorage;
|
||||||
@@ -549,6 +549,9 @@ static Group authorizationRecipe()
|
|||||||
credential.setData(*dd->m_apiToken);
|
credential.setData(*dd->m_apiToken);
|
||||||
return SetupResult::Continue;
|
return SetupResult::Continue;
|
||||||
};
|
};
|
||||||
|
const auto onSetCredentialDone = [](const CredentialQuery &credential) {
|
||||||
|
MessageManager::writeDisrupting(QString("Axivion: %1").arg(credential.errorString()));
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
Group {
|
Group {
|
||||||
@@ -572,7 +575,7 @@ static Group authorizationRecipe()
|
|||||||
apiTokenStorage,
|
apiTokenStorage,
|
||||||
onGroupSetup(onApiTokenGroupSetup),
|
onGroupSetup(onApiTokenGroupSetup),
|
||||||
dtoRecipe(apiTokenStorage),
|
dtoRecipe(apiTokenStorage),
|
||||||
CredentialQueryTask(onSetCredentialSetup)
|
CredentialQueryTask(onSetCredentialSetup, onSetCredentialDone, CallDoneIf::Error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user