Error cleanup (close #79) (#148)

* Avoid surfacing errors to the user when it's not critical

* Remove now-unused GetAssertionsView

* Apply cleanError() consistently

* Give a better error message for Upstream Failures (http status 502)

* Hide errors in notifications because they're not useful
This commit is contained in:
Paul Frazee
2023-02-03 13:26:58 -06:00
committed by GitHub
parent eb1568e0fd
commit 0e6b53258b
21 changed files with 73 additions and 165 deletions
+4 -1
View File
@@ -198,7 +198,7 @@ export function enforceLen(str: string, len: number, ellipsis = false): string {
export function cleanError(str: any): string {
if (!str) {
return str
return ''
}
if (typeof str !== 'string') {
str = str.toString()
@@ -206,6 +206,9 @@ export function cleanError(str: any): string {
if (isNetworkError(str)) {
return '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.startsWith('Error: ')) {
return str.slice('Error: '.length)
}