Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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!
  • Loading branch information
kylecarbs committed Aug 9, 2022
commit 22477dbb6a8a76bae60eb0e83d64c4fc761d93fb
3 changes: 3 additions & 0 deletions site/src/api/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export type ApiError = AxiosError<ApiErrorResponse> & { 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" &&
Expand Down