From aa377623c265b83b54d11fd731aab400ffb1883c Mon Sep 17 00:00:00 2001 From: Hugh <90424587+HughParry@users.noreply.github.com> Date: Wed, 11 Dec 2024 20:19:57 +0000 Subject: [PATCH] Providers alert if client details update fails (#1568) --- packages/locale/src/locales/de.json | 3 ++- packages/locale/src/locales/en.json | 3 ++- packages/locale/src/locales/es.json | 3 ++- packages/locale/src/locales/fr.json | 3 ++- packages/locale/src/locales/it.json | 3 ++- packages/locale/src/locales/pt-BR.json | 3 ++- packages/locale/src/locales/pt.json | 3 ++- packages/provider/src/tasks/client/clientTasks.ts | 8 ++++++-- 8 files changed, 20 insertions(+), 9 deletions(-) diff --git a/packages/locale/src/locales/de.json b/packages/locale/src/locales/de.json index 6aa2eda2c..6d500375e 100644 --- a/packages/locale/src/locales/de.json +++ b/packages/locale/src/locales/de.json @@ -77,7 +77,8 @@ "SOLUTION_FLAG_FAILED": "Lösung konnte nicht als verarbeitet markiert werden", "TABLES_UNDEFINED": "Tabellen undefiniert", "CONNECTION_UNDEFINED": "Verbindung undefiniert", - "COMMITMENT_FLAG_FAILED": "Verpflichtung konnte nicht als verarbeitet markiert werden" + "COMMITMENT_FLAG_FAILED": "Verpflichtung konnte nicht als verarbeitet markiert werden", + "UNKNOWN": "Unbekannter Datenbankfehler" }, "CAPTCHA": { "PARSE_ERROR": "Fehler beim Parsen des Captchas", diff --git a/packages/locale/src/locales/en.json b/packages/locale/src/locales/en.json index 92e056e8c..0f36ca5c2 100644 --- a/packages/locale/src/locales/en.json +++ b/packages/locale/src/locales/en.json @@ -77,7 +77,8 @@ "SOLUTION_FLAG_FAILED": "Failed to flag solution as processed", "TABLES_UNDEFINED": "Tables undefined", "CONNECTION_UNDEFINED": "Connection undefined", - "COMMITMENT_FLAG_FAILED": "Failed to flag commitment as processed" + "COMMITMENT_FLAG_FAILED": "Failed to flag commitment as processed", + "UNKNOWN": "Unknown database error" }, "CAPTCHA": { "PARSE_ERROR": "Error parsing captcha", diff --git a/packages/locale/src/locales/es.json b/packages/locale/src/locales/es.json index 02eda4de6..080c9bede 100644 --- a/packages/locale/src/locales/es.json +++ b/packages/locale/src/locales/es.json @@ -77,7 +77,8 @@ "SOLUTION_FLAG_FAILED": "Error al marcar la solución como procesada", "TABLES_UNDEFINED": "Tablas indefinidas", "CONNECTION_UNDEFINED": "Conexión indefinida", - "COMMITMENT_FLAG_FAILED": "Error al marcar el compromiso como procesado" + "COMMITMENT_FLAG_FAILED": "Error al marcar el compromiso como procesado", + "UNKNOWN": "Error desconocido de base de datos" }, "CAPTCHA": { "PARSE_ERROR": "Error al analizar el captcha", diff --git a/packages/locale/src/locales/fr.json b/packages/locale/src/locales/fr.json index 234d0c722..b6828d313 100644 --- a/packages/locale/src/locales/fr.json +++ b/packages/locale/src/locales/fr.json @@ -77,7 +77,8 @@ "SOLUTION_FLAG_FAILED": "Échec du marquage de la solution comme traitée", "TABLES_UNDEFINED": "Tables non définies", "CONNECTION_UNDEFINED": "Connexion non définie", - "COMMITMENT_FLAG_FAILED": "Échec du marquage de l'engagement comme traité" + "COMMITMENT_FLAG_FAILED": "Échec du marquage de l'engagement comme traité", + "UNKNOWN": "Erreur de base de données inconnue" }, "CAPTCHA": { "PARSE_ERROR": "Erreur d'analyse du captcha", diff --git a/packages/locale/src/locales/it.json b/packages/locale/src/locales/it.json index 9609f7dac..f496771be 100644 --- a/packages/locale/src/locales/it.json +++ b/packages/locale/src/locales/it.json @@ -77,7 +77,8 @@ "SOLUTION_FLAG_FAILED": "Impossibile contrassegnare la soluzione come elaborata", "TABLES_UNDEFINED": "Tabelle indefinite", "CONNECTION_UNDEFINED": "Connessione indefinita", - "COMMITMENT_FLAG_FAILED": "Impossibile contrassegnare l'impegno come elaborato" + "COMMITMENT_FLAG_FAILED": "Impossibile contrassegnare l'impegno come elaborato", + "UNKNOWN": "Errore database sconosciuto" }, "CAPTCHA": { "PARSE_ERROR": "Errore nell'analisi del captcha", diff --git a/packages/locale/src/locales/pt-BR.json b/packages/locale/src/locales/pt-BR.json index 21b16378d..b4ac08fb0 100644 --- a/packages/locale/src/locales/pt-BR.json +++ b/packages/locale/src/locales/pt-BR.json @@ -77,7 +77,8 @@ "SOLUTION_FLAG_FAILED": "Falha ao marcar a solução como processada", "TABLES_UNDEFINED": "Tabelas indefinidas", "CONNECTION_UNDEFINED": "Conexão indefinida", - "COMMITMENT_FLAG_FAILED": "Falha ao marcar o compromisso como processado" + "COMMITMENT_FLAG_FAILED": "Falha ao marcar o compromisso como processado", + "UNKNOWN": "Erro de banco de dados desconhecido" }, "CAPTCHA": { "PARSE_ERROR": "Erro ao analisar o captcha", diff --git a/packages/locale/src/locales/pt.json b/packages/locale/src/locales/pt.json index 042f116f9..79617b003 100644 --- a/packages/locale/src/locales/pt.json +++ b/packages/locale/src/locales/pt.json @@ -77,7 +77,8 @@ "SOLUTION_FLAG_FAILED": "Falha ao marcar a solução como processada", "TABLES_UNDEFINED": "Tabelas indefinidas", "CONNECTION_UNDEFINED": "Conexão indefinida", - "COMMITMENT_FLAG_FAILED": "Falha ao marcar o compromisso como processado" + "COMMITMENT_FLAG_FAILED": "Falha ao marcar o compromisso como processado", + "UNKNOWN": "Erro de banco de dados desconhecido" }, "CAPTCHA": { "PARSE_ERROR": "Erro ao analisar o captcha", diff --git a/packages/provider/src/tasks/client/clientTasks.ts b/packages/provider/src/tasks/client/clientTasks.ts index 429f95113..497e17f80 100644 --- a/packages/provider/src/tasks/client/clientTasks.ts +++ b/packages/provider/src/tasks/client/clientTasks.ts @@ -13,7 +13,7 @@ // limitations under the License. import { validateAddress } from "@polkadot/util-crypto/address"; -import type { Logger } from "@prosopo/common"; +import { type Logger, ProsopoApiError } from "@prosopo/common"; import { CaptchaDatabase, ClientDatabase } from "@prosopo/database"; import { type IUserSettings, @@ -191,7 +191,11 @@ export class ClientTaskManager { }, ); } catch (e: unknown) { - this.logger.error(e); + const getClientListError = new ProsopoApiError("DATABASE.UNKNOWN", { + context: { error: e }, + logger: this.logger, + }); + this.logger.error(getClientListError, { context: { error: e } }); await this.providerDB.updateScheduledTaskStatus( taskID, ScheduledTaskStatus.Failed,