#556 : fixed error messages

This commit is contained in:
Monobikash Das
2023-02-14 14:46:20 +05:30
parent 8fc39d93f0
commit 1a699b61bc
9 changed files with 46 additions and 5 deletions

View File

@@ -360,6 +360,9 @@
"missingPermission": "This app uses the camera to scan the QR code of another device."
},
"allowAccess": "Allow access to the camera"
},
"errors": {
"genericError": "Something went wrong. Please try again after some time!"
}
}
}

View File

@@ -331,6 +331,9 @@
"cancel": "Kanselahin",
"save": "I-save",
"editLabel": "Palitan ang {{label}}",
"tryAgain": "Subukan muli"
"tryAgain": "Subukan muli",
"errors": {
"genericError": "Nagkaproblema. Pakisubukang muli pagkatapos ng ilang oras!"
}
}
}

View File

@@ -366,6 +366,9 @@
"missingPermission": "यह ऐप दूसरे डिवाइस के क्यूआर कोड को स्कैन करने के लिए कैमरे का इस्तेमाल करता है."
},
"allowAccess": "कैमरे तक पहुंच की अनुमति दें"
},
"errors": {
"genericError": "कुछ गलत हो गया। कृपया कुछ समय बाद पुन: प्रयास करें!"
}
}
}

View File

@@ -366,6 +366,9 @@
"missingPermission": "ಮತ್ತೊಂದು ಸಾಧನದ QR ಕೋಡ್ ಅನ್ನು ಸ್ಕ್ಯಾನ್ ಮಾಡಲು ಈ ಅಪ್ಲಿಕೇಶನ್ ಕ್ಯಾಮರಾವನ್ನು ಬಳಸುತ್ತದೆ."
},
"allowAccess": "ಕ್ಯಾಮರಾಗೆ ಪ್ರವೇಶವನ್ನು ಅನುಮತಿಸಿ"
},
"errors": {
"genericError": "ಏನೋ ತಪ್ಪಾಗಿದೆ. ದಯವಿಟ್ಟು ಸ್ವಲ್ಪ ಸಮಯದ ನಂತರ ಮತ್ತೆ ಪ್ರಯತ್ನಿಸಿ!"
}
}
}

View File

@@ -365,6 +365,9 @@
"missingPermission": "இந்தப் பயன்பாடு மற்றொரு சாதனத்தின் QR குறியீட்டை ஸ்கேன் செய்ய கேமராவைப் பயன்படுத்துகிறது."
},
"allowAccess": "கேமராவை அணுக அனுமதிக்கவும்"
},
"errors": {
"genericError": "ஏதோ தவறு நடந்துவிட்டது. சிறிது நேரம் கழித்து மீண்டும் முயற்சிக்கவும்!"
}
}
}

View File

@@ -15,6 +15,7 @@ import { linkTransactionResponse, VC } from '../types/vc';
import { request } from '../shared/request';
import { getJwt } from '../shared/cryptoutil/cryptoUtil';
import { getPrivateKey } from '../shared/keystore/SecureKeystore';
import i18n from '../i18n';
const model = createModel(
{
@@ -286,7 +287,9 @@ export const qrLoginMachine =
SetErrorMessage: assign({
errorMessage: (context, event) =>
(event as ErrorPlatformEvent).data.message,
i18n.t(`errors.genericError`, {
ns: 'common',
}),
}),
setConsentClaims: assign({

View File

@@ -25,6 +25,7 @@ import {
import getAllConfigurations, {
DownloadProps,
} from '../shared/commonprops/commonProps';
import i18n from '../i18n';
const model = createModel(
{
@@ -497,7 +498,10 @@ export const vcItemMachine =
{
actions: {
setWalletBindingError: assign({
walletBindingError: (context, event) => (event.data as Error).message,
walletBindingError: (context, event) =>
i18n.t(`errors.genericError`, {
ns: 'common',
}),
}),
setWalletBindingErrorEmpty: assign({

View File

@@ -247,7 +247,9 @@ export const AddVcModalMachine =
? i18n.t(`errors.backend.${ID_ERRORS_MAP[message]}`, {
ns: 'AddVcModal',
})
: message;
: i18n.t(`errors.genericError`, {
ns: 'common',
});
},
}),

View File

@@ -24,11 +24,28 @@ export async function request(
const jsonResponse = await response.json();
if (response.status >= 400) {
throw new Error(jsonResponse.message || jsonResponse.error);
let backendUrl = HOST + path;
let errorMessage = jsonResponse.message || jsonResponse.error;
console.error(
'The backend API ' +
backendUrl +
' returned error code 400 with message --> ' +
errorMessage
);
throw new Error(errorMessage);
}
if (jsonResponse.errors && jsonResponse.errors.length) {
let backendUrl = HOST + path;
const { errorCode, errorMessage } = jsonResponse.errors.shift();
console.error(
'The backend API ' +
backendUrl +
' returned error response --> error code is : ' +
errorCode +
' error message is : ' +
errorMessage
);
throw new BackendResponseError(errorCode, errorMessage);
}