Skip to content

Throw more descriptive error messages#20

Open
maffe03 wants to merge 3 commits intomainfrom
descriptive-error-messages
Open

Throw more descriptive error messages#20
maffe03 wants to merge 3 commits intomainfrom
descriptive-error-messages

Conversation

@maffe03
Copy link
Member

@maffe03 maffe03 commented Mar 1, 2026

Throw error messages that include the actual error from the backend instead of an http code, if available.

console.error(apiError);
if (apiError?.error?.message) errorMessage = apiError.error.message;
} finally {
throw new Error(errorMessage);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The APIError on the backend is very descriptive. We might as well include timestamp, statuscode, and endpoint-path as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@HellFelix
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants