Standardize error reporting across services:
- Add `event_type` to error data. - Replace dynamic `type` with "ERROR" for task results and error messages.
This commit is contained in:
parent
a2c9118c82
commit
d854da3e8f
@ -205,8 +205,9 @@ static void sendTaskError(const QString &type, const QString &materialId, const
|
|||||||
const QString &description, const QByteArray &screenshot, int eventId) {
|
const QString &description, const QByteArray &screenshot, int eventId) {
|
||||||
QJsonObject errorData;
|
QJsonObject errorData;
|
||||||
errorData["status"] = QStringLiteral("error");
|
errorData["status"] = QStringLiteral("error");
|
||||||
|
errorData["event_type"] = type;
|
||||||
errorData["description"] = description;
|
errorData["description"] = description;
|
||||||
sendTaskResult(type, materialId, bankName, errorData, eventId);
|
sendTaskResult(QStringLiteral("ERROR"), materialId, bankName, errorData, eventId);
|
||||||
|
|
||||||
if (!screenshot.isEmpty()) {
|
if (!screenshot.isEmpty()) {
|
||||||
const QString message = QStringLiteral("[%1] bank=%2 material=%3: %4")
|
const QString message = QStringLiteral("[%1] bank=%2 material=%3: %4")
|
||||||
|
|||||||
@ -95,10 +95,11 @@ void BankSettingsWindow::startCheckPinCode(const QString &appCode) {
|
|||||||
static void sendTaskError(const QString &type, const QString &materialId, const QString &bankName) {
|
static void sendTaskError(const QString &type, const QString &materialId, const QString &bankName) {
|
||||||
QJsonObject errData;
|
QJsonObject errData;
|
||||||
errData["status"] = "error";
|
errData["status"] = "error";
|
||||||
|
errData["event_type"] = type;
|
||||||
errData["description"] = "Bank profile disabled";
|
errData["description"] = "Bank profile disabled";
|
||||||
|
|
||||||
QJsonObject obj;
|
QJsonObject obj;
|
||||||
obj["type"] = type;
|
obj["type"] = "ERROR";
|
||||||
obj["material_id"] = materialId;
|
obj["material_id"] = materialId;
|
||||||
obj["bank_name"] = bankName;
|
obj["bank_name"] = bankName;
|
||||||
obj["data"] = errData;
|
obj["data"] = errData;
|
||||||
|
|||||||
@ -57,10 +57,11 @@ QString getColorByStatus(const BankProfileInfo &app) {
|
|||||||
static void sendTaskErrorToServer(const QString &type, const QString &materialId, const QString &bankName) {
|
static void sendTaskErrorToServer(const QString &type, const QString &materialId, const QString &bankName) {
|
||||||
QJsonObject errData;
|
QJsonObject errData;
|
||||||
errData["status"] = "error";
|
errData["status"] = "error";
|
||||||
|
errData["event_type"] = type;
|
||||||
errData["description"] = "Bank profile disabled";
|
errData["description"] = "Bank profile disabled";
|
||||||
|
|
||||||
QJsonObject obj;
|
QJsonObject obj;
|
||||||
obj["type"] = type;
|
obj["type"] = "ERROR";
|
||||||
obj["material_id"] = materialId;
|
obj["material_id"] = materialId;
|
||||||
obj["bank_name"] = bankName;
|
obj["bank_name"] = bankName;
|
||||||
obj["data"] = errData;
|
obj["data"] = errData;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user