ActivityPub-federated video streaming platform using P2P directly in your web browser
Handle 502 errors
Chocobozzz608a77e350ba
diff --git a/client/src/app/core/notification/notifier.service.ts b/client/src/app/core/notification/notifier.service.tsindex bf31891f23..26f8b9bc9e 100644--- a/client/src/app/core/notification/notifier.service.ts+++ b/client/src/app/core/notification/notifier.service.ts@@ -34,16 +34,29 @@ export class Notifier {handleError (err: Error) {if (err instanceof PeerTubeReconnectError && err.alreadyNotified) return+ const text = this.buildErrorText(err)+if (err instanceof PeerTubeHTTPError) {- const message = `Backend returned code ${err.status}, errorMessage is: ${err.message}`+ const logMessage = `Backend returned code ${err.status}, errorMessage is: ${err.message}`- if (err.status === HttpStatusCode.NOT_FOUND_404) logger.clientError(message)- else logger.error(message, { url: err.url })+ if (err.status === HttpStatusCode.NOT_FOUND_404) logger.clientError(logMessage)+ else logger.error(logMessage, { url: err.url })} else {logger.error(err.message, err)}- return this.notify({ severity: 'error', text: err.message, title: $localize`Error` })+ return this.notify({ severity: 'error', text, title: $localize`Error` })+ }++ private buildErrorText (err: Error) {+ if (+ (err instanceof PeerTubeHTTPError && err.status === HttpStatusCode.BAD_GATEWAY_502) ||+ err.message?.toLowerCase() === 'bad gateway'+ ) {+ return $localize`Server is unavailable. Please retry later.`+ }++ return err.message}private notify (options: {