Better error message (+ translations!) (#6349)
* clean network errors for new common eerors * translate errors
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import {t} from '@lingui/macro'
|
||||||
|
|
||||||
export function cleanError(str: any): string {
|
export function cleanError(str: any): string {
|
||||||
if (!str) {
|
if (!str) {
|
||||||
return ''
|
return ''
|
||||||
@@ -6,13 +8,17 @@ export function cleanError(str: any): string {
|
|||||||
str = str.toString()
|
str = str.toString()
|
||||||
}
|
}
|
||||||
if (isNetworkError(str)) {
|
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')) {
|
if (
|
||||||
return 'The server appears to be experiencing issues. Please try again in a few moments.'
|
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')) {
|
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: ')) {
|
if (str.startsWith('Error: ')) {
|
||||||
return str.slice('Error: '.length)
|
return str.slice('Error: '.length)
|
||||||
|
|||||||
Reference in New Issue
Block a user