display Unexpected error: {exception message} instead of Unknown error upon login

This commit is contained in:
Florent Azavant
2025-01-13 16:00:09 +01:00
committed by Dat H. Pham
parent 9d54709fac
commit 03819a7a9b
3 changed files with 21 additions and 1 deletions
+10
View File
@@ -120,6 +120,16 @@
"placeholders_order": [],
"placeholders": {}
},
"unexpectedError": "Unexpected error: {errorMessage}",
"@unexpectedError": {
"type": "text",
"placeholders_order": [
"errorMessage"
],
"placeholders": {
"errorMessage": {}
}
},
"search_folder": "Search folder",
"@search_folder": {
"type": "text",
@@ -114,6 +114,12 @@ class AppLocalizations {
name: 'unknownError');
}
String unexpectedError(String errorMessage) {
return Intl.message('Unexpected error: $errorMessage',
name: 'unexpectedError',
args: [errorMessage]);
}
String get search_folder {
return Intl.message(
'Search folder',
+5 -1
View File
@@ -50,7 +50,11 @@ class ToastManager {
} else if (exception is NoNetworkError) {
return AppLocalizations.of(context).youAreOffline;
} else {
return null;
try {
return AppLocalizations.of(context).unexpectedError(exception.message);
} catch(_) {
return AppLocalizations.of(context).unexpectedError(exception.toString());
}
}
}