about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2024-11-15 22:16:57 +0000
committerGitHub <noreply@github.com>2024-11-15 22:16:57 +0000
commita9cacbf265526879b7eb5f89fcc0df099edb0e5b (patch)
tree84312b9c1825f3bee562fcdf4fc06f4253a686cb
parent3bd14371330abf902690dff9b3f0f2036ef472e5 (diff)
downloadvoidsky-a9cacbf265526879b7eb5f89fcc0df099edb0e5b.tar.zst
Better error message (+ translations!) (#6349)
* clean network errors for new common eerors

* translate errors
-rw-r--r--src/lib/strings/errors.ts14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lib/strings/errors.ts b/src/lib/strings/errors.ts
index 7d00c5e7f..1a010fea6 100644
--- a/src/lib/strings/errors.ts
+++ b/src/lib/strings/errors.ts
@@ -1,3 +1,5 @@
+import {t} from '@lingui/macro'
+
 export function cleanError(str: any): string {
   if (!str) {
     return ''
@@ -6,13 +8,17 @@ export function cleanError(str: any): string {
     str = str.toString()
   }
   if (isNetworkError(str)) {
-    return 'Unable to connect. Please check your internet connection and try again.'
+    return t`Unable to connect. Please check your internet connection and try again.`
   }
-  if (str.includes('Upstream Failure')) {
-    return 'The server appears to be experiencing issues. Please try again in a few moments.'
+  if (
+    str.includes('Upstream Failure') ||
+    str.includes('NotEnoughResources') ||
+    str.includes('pipethrough network error')
+  ) {
+    return t`The server appears to be experiencing issues. Please try again in a few moments.`
   }
   if (str.includes('Bad token scope')) {
-    return 'This feature is not available while using an App Password. Please sign in with your main password.'
+    return t`This feature is not available while using an App Password. Please sign in with your main password.`
   }
   if (str.startsWith('Error: ')) {
     return str.slice('Error: '.length)