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

Proper error handling #16

Open
Nutomic opened this issue Feb 8, 2024 · 3 comments
Open

Proper error handling #16

Nutomic opened this issue Feb 8, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@Nutomic
Copy link
Owner

Nutomic commented Feb 8, 2024

The project currently uses unwrap all over the place, meaning it will crash if anything goes wrong. Need to get rid of this, add proper error handling and forbid unwrap usage via clippy.

Edit: The ServerFnError type provided by leptos is not suited to our use case. We should get rid of that and provide our own error type, maybe simply FrontendError(String).

@Nutomic
Copy link
Owner Author

Nutomic commented Feb 28, 2024

6dd1711 cleanly handles all backend errors. Still lots of unwrap in the frontend.

@Doomsdayrs
Copy link

One of the biggest errors I see is related to #40

article_resource() unwraps the result, without care for the error.

Thus, the return type must be changed from
Resource<Option<String>, ArticleView> to Resource<Option<String>, Result<ArticleView, Error>>

The problem with this is that all other views depend on the the resource being the first type.

This means every view must be modified to support the new result type.

The only issue is that ArticleNav depends on the first type.

Now honestly am stuck with my lack of rust knowledge.

@Nutomic
Copy link
Owner Author

Nutomic commented Apr 2, 2024

Best open a pull request with the changes you have so far, that way I can have a look myself.

@Nutomic Nutomic added the enhancement New feature or request label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants