Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display Error Message in Toasts #1408

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

sharunkumar
Copy link
Contributor

@sharunkumar sharunkumar commented Apr 13, 2024

Fixes #1399

@@ -0,0 +1,7 @@
export function presentErrorMessage(message: string, error: unknown): string {
Copy link
Owner

Choose a reason for hiding this comment

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

Hey thanks for the PR!

I see your PR exposes the raw error from lemmy. Voyager's current error handling approach is to handle each error and convert to english. This also adds the ability to compose specific, helpful error messages for more casual Voyager/lemmy users. You can see that in helpers/lemmyErrors.ts

I think we could make a function, getCreatePostErrorMessage similar to the existing getVoteErrorMessage.

We could also do that for other errors, as I see in your PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like the implementation of getVoteErrorMessage but I would make a change where I would still like to add the raw error message in the fallback condition. This way, even if there is an error which we have not handled (mapped to a user-friendly message) there would at least be some information available to the user - which was the original issue I was facing with #1399

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me know if the changes in 86fb640 works. Motivation here is to provide some message to the user rather than a generic one, when we have not handled the lemmy version of the error

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.

Show the right error message to the user
2 participants