From 22477dbb6a8a76bae60eb0e83d64c4fc761d93fb Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Tue, 9 Aug 2022 14:13:11 +0000 Subject: [PATCH] fix: Check if an API error has data before checking the message This was causing the app to crash with an error. I found this manually by looking through the obfuscated sources in DevTools. It's a data-point for #3425 though! --- site/src/api/errors.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/site/src/api/errors.ts b/site/src/api/errors.ts index 56f385b19959d..b65c3d038da27 100644 --- a/site/src/api/errors.ts +++ b/site/src/api/errors.ts @@ -25,6 +25,9 @@ export type ApiError = AxiosError & { response: AxiosResponse< export const isApiError = (err: any): err is ApiError => { if (axios.isAxiosError(err)) { const response = err.response?.data + if (!response) { + return false + } return ( typeof response.message === "string" &&