diff --git a/apps/console/src/RelayEnvironment.ts b/apps/console/src/RelayEnvironment.ts index 1995fe1bb..915b46ff3 100644 --- a/apps/console/src/RelayEnvironment.ts +++ b/apps/console/src/RelayEnvironment.ts @@ -15,6 +15,13 @@ export class UnAuthenticatedError extends Error { } } +export class InternalServerError extends Error { + constructor() { + super("INTERNAL_SERVER_ERROR"); + this.name = "InternalServerError"; + } +} + const hasUnauthenticatedError = (error: GraphQLError) => error.extensions?.code == "UNAUTHENTICATED"; @@ -75,6 +82,10 @@ const fetchRelay: FetchFunction = async ( requestInit ); + if (response.status === 500) { + throw new InternalServerError(); + } + const json = await response.json(); if (json.errors) {