From aeca799006a7632cfa0ba38ab3bcaaf8fefdf2a0 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Mon, 16 Nov 2020 14:37:14 +0100 Subject: [PATCH] Harmonize error handling, ignore 404 (for now) --- qml/js/functions.js | 12 ++++++++++++ qml/pages/ChatPage.qml | 6 +----- qml/pages/OverviewPage.qml | 6 +----- translations/harbour-fernschreiber-de.ts | 12 ++++-------- translations/harbour-fernschreiber-en.ts | 12 ++++-------- translations/harbour-fernschreiber-es.ts | 12 ++++-------- translations/harbour-fernschreiber-fi.ts | 12 ++++-------- translations/harbour-fernschreiber-hu.ts | 12 ++++-------- translations/harbour-fernschreiber-it.ts | 12 ++++-------- translations/harbour-fernschreiber-pl.ts | 12 ++++-------- translations/harbour-fernschreiber-ru.ts | 12 ++++-------- translations/harbour-fernschreiber-sv.ts | 12 ++++-------- translations/harbour-fernschreiber-zh_CN.ts | 12 ++++-------- translations/harbour-fernschreiber.ts | 12 ++++-------- 14 files changed, 58 insertions(+), 98 deletions(-) diff --git a/qml/js/functions.js b/qml/js/functions.js index 8a8a9ca..e7fa25e 100644 --- a/qml/js/functions.js +++ b/qml/js/functions.js @@ -394,3 +394,15 @@ function getMessagesArrayText(messages) { } return lines.join("\n"); } + +function handleErrorMessage(code, message) { + if (code === 404) { + // Silently ignore 404 Not Found messages (occur sometimes, without clear context...) + return; + } + if (message === "USER_ALREADY_PARTICIPANT") { + appNotification.show(qsTr("You are already a member of this chat.")); + } else { + appNotification.show(message); + } +} diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 4612588..ace6181 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -341,11 +341,7 @@ Page { chatPage.emojiProposals = result; } onErrorReceived: { - if (message === "USER_ALREADY_PARTICIPANT") { - appNotification.show(qsTr("You are already a member of this chat.")); - } else { - appNotification.show(message); - } + Functions.handleErrorMessage(code, message); } } diff --git a/qml/pages/OverviewPage.qml b/qml/pages/OverviewPage.qml index 7a726b0..27a9113 100644 --- a/qml/pages/OverviewPage.qml +++ b/qml/pages/OverviewPage.qml @@ -160,11 +160,7 @@ Page { } } onErrorReceived: { - if (message === "USER_ALREADY_PARTICIPANT") { - appNotification.show(qsTr("You are already a member of this chat.")); - } else { - appNotification.show(message); - } + Functions.handleErrorMessage(code, message); } } diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index efd3373..8335fa8 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -347,10 +347,6 @@ %n Nachrichten weiterleiten - - You are already a member of this chat. - Sie sind bereits Mitglied dieses Chats. - ChatSelectionPage @@ -900,10 +896,6 @@ You don't have any chats yet. Sie haben noch keine Chats. - - You are already a member of this chat. - Sie sind bereits Mitglied dieses Chats. - PollCreationPage @@ -1530,5 +1522,9 @@ sent a video note hat eine Videonachricht geschickt + + You are already a member of this chat. + Sie sind bereits Mitglied dieses Chats. + diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index ba48ac2..80ac99f 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -347,10 +347,6 @@ Forward %n messages - - You are already a member of this chat. - You are already a member of this chat. - ChatSelectionPage @@ -900,10 +896,6 @@ You don't have any chats yet. You don't have any chats yet. - - You are already a member of this chat. - You are already a member of this chat. - PollCreationPage @@ -1530,5 +1522,9 @@ sent a video note sent a video note + + You are already a member of this chat. + You are already a member of this chat. + diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 399dc9a..4829037 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -343,10 +343,6 @@ Reenviar %n mensajes - - You are already a member of this chat. - Ya eres miembro de este grupo. - ChatSelectionPage @@ -896,10 +892,6 @@ You don't have any chats yet. No hay todavía ninguna charla. - - You are already a member of this chat. - Ya eres miembro de este grupo. - PollCreationPage @@ -1520,5 +1512,9 @@ sent a video note envió una nota de video + + You are already a member of this chat. + Ya eres miembro de este grupo. + diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 7a41c88..25910c6 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -347,10 +347,6 @@ - - You are already a member of this chat. - Olet jo tämän ryhmän jäsen. - ChatSelectionPage @@ -901,10 +897,6 @@ You don't have any chats yet. Sinulla ei ole vielä keskusteluja. - - You are already a member of this chat. - Olet jo tämän ryhmän jäsen. - PollCreationPage @@ -1531,5 +1523,9 @@ sent a video note + + You are already a member of this chat. + Olet jo tämän ryhmän jäsen. + diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index b6f24dc..5ae30cc 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -343,10 +343,6 @@ - - You are already a member of this chat. - - ChatSelectionPage @@ -896,10 +892,6 @@ You don't have any chats yet. - - You are already a member of this chat. - - PollCreationPage @@ -1520,5 +1512,9 @@ sent a video note + + You are already a member of this chat. + + diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 034942d..33e5ef3 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -347,10 +347,6 @@ - - You are already a member of this chat. - Sei già membro di questa chat. - ChatSelectionPage @@ -900,10 +896,6 @@ Loading chat list... Carica lista chat... - - You are already a member of this chat. - Sei già membro di questa chat. - PollCreationPage @@ -1530,5 +1522,9 @@ sent a video note + + You are already a member of this chat. + Sei già membro di questa chat. + diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index a5663d3..bc554af 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -351,10 +351,6 @@ - - You are already a member of this chat. - - ChatSelectionPage @@ -904,10 +900,6 @@ You don't have any chats yet. Nie masz jeszcze żadnych czatów. - - You are already a member of this chat. - - PollCreationPage @@ -1540,5 +1532,9 @@ sent a video note + + You are already a member of this chat. + + diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 4792b55..0b7d7ea 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -351,10 +351,6 @@ - - You are already a member of this chat. - Вы уже в этом чате. - ChatSelectionPage @@ -904,10 +900,6 @@ You don't have any chats yet. Тут пока ничего нет - - You are already a member of this chat. - Вы уже в этом чате. - PollCreationPage @@ -1540,5 +1532,9 @@ sent a video note + + You are already a member of this chat. + Вы уже в этом чате. + diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index e75beaa..fa0dfe8 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -347,10 +347,6 @@ - - You are already a member of this chat. - Du är redan medlem i den här chatten. - ChatSelectionPage @@ -900,10 +896,6 @@ You don't have any chats yet. Du har inga chattar än. - - You are already a member of this chat. - Du är redan medlem i den här chatten. - PollCreationPage @@ -1530,5 +1522,9 @@ sent a video note + + You are already a member of this chat. + Du är redan medlem i den här chatten. + diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 32940a5..01db2e9 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -343,10 +343,6 @@ - - You are already a member of this chat. - 你已是此对话的成员。 - ChatSelectionPage @@ -896,10 +892,6 @@ You don't have any chats yet. 你还没有任何对话。 - - You are already a member of this chat. - 你已是此对话的成员。 - PollCreationPage @@ -1520,5 +1512,9 @@ sent a video note + + You are already a member of this chat. + 你已是此对话的成员。 + diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index 72ffe9e..14ff145 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -343,10 +343,6 @@ - - You are already a member of this chat. - - ChatSelectionPage @@ -896,10 +892,6 @@ You don't have any chats yet. - - You are already a member of this chat. - - PollCreationPage @@ -1520,5 +1512,9 @@ sent a video note + + You are already a member of this chat. + +