From 1b704e0954bb6ca81fc091717b18e7401aa3731f Mon Sep 17 00:00:00 2001 From: Dennis Chen Date: Mon, 5 Aug 2024 16:18:42 -0700 Subject: [PATCH] have humanReadableError return strings verbatim If typeof error === 'string', then obviously the string `error` is the error we should be returning. --- frontend/src/constants/backend.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/constants/backend.ts b/frontend/src/constants/backend.ts index 67f984ed..79826320 100644 --- a/frontend/src/constants/backend.ts +++ b/frontend/src/constants/backend.ts @@ -5,7 +5,9 @@ export const BACKEND_URL = // eslint-disable-next-line export const humanReadableError = (error: any | undefined) => { - if (isAxiosError(error)) { + if (typeof error === "string") { + return error; + } else if (isAxiosError(error)) { const axiosError = error as AxiosError; const request = axiosError.request, response = axiosError.response;