Skip to content

Commit 53400c6

Browse files
authored
fix: Check if an API error has data before checking the message (#3427)
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!
1 parent e1da2b6 commit 53400c6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

site/src/api/errors.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ export type ApiError = AxiosError<ApiErrorResponse> & { response: AxiosResponse<
2525
export const isApiError = (err: any): err is ApiError => {
2626
if (axios.isAxiosError(err)) {
2727
const response = err.response?.data
28+
if (!response) {
29+
return false
30+
}
2831

2932
return (
3033
typeof response.message === "string" &&

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy