Conversation
frontend/src/api/host.ts
Outdated
| console.error(apiError); | ||
| if (apiError?.error?.message) errorMessage = apiError.error.message; | ||
| } finally { | ||
| throw new Error(errorMessage); |
There was a problem hiding this comment.
The APIError on the backend is very descriptive. We might as well include timestamp, statuscode, and endpoint-path as well
There was a problem hiding this comment.
I wasn't sure if that would be more information than necessary for the user? That's why i just put it in the console instead. But yes that works too!
There was a problem hiding this comment.
The errors aren't going to mean much to the user anyway. The reason I put all the info in there was so that the user could take a screenshot and show it to one of the developers (or tech support)
It's much easier to debug if we know exactly where the error comes from. If we can narrow it down to the exact path and the exact error type, we can likely narrow it down to the exact line where it fails (or near enough to make no difference).
|
I've made some edits. Still not all the way there, but I made a standardized ErrorAlert component that can be used for all the APIError instances, and added to most of the error alerts I found. You're welcome to look into this further if you'd like |
Throw error messages that include the actual error from the backend instead of an http code, if available.