-
-
Notifications
You must be signed in to change notification settings - Fork 583
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
Update ErrorBoundary to use miette::Diagnostic instead of Error, and various other tweaks #401
Conversation
standardize on some things
type to be a Diagnostic
So this should be ready to merge, assuming the test passes. The todo_sqlite_axum example has been updated to show a more complete error handling scheme, and there are still some convenience changes to unify Error handling and clear up some API quirks |
Yeah looks good. But I think you can remove the I'm also wondering if we should abstract away from making the This PR is already a breaking change from |
Forgot to save that file. I mean we certainly could limit visibility to the HashMap, I'm just not sure I want to reimplement all or some of hashmap's methods. I thought you wanted HydrationKey so you can do cleanup? |
New Example for Errors with Axum and Cleanup of Axum Todo Example
…various other tweaks (#401) * Switch RwLock to parking_lot so they are no longer async * cleanup todo_app_sqlite_axum * add errors_axum example --------- Co-authored-by: Indrazar <110272232+Indrazar@users.noreply.github.com>
So my goal here has always been to have one standard, pretty page for errors, and a general way to catch errors both at the routing level and inside the app.
This PR should allow one to use one template for both kinds of Errors, and provide additional metadata. It also creates a neat(IMO) way to map between unique Rust Errors and HTTP statuscodes.
You can see it working in the todo_app_sqlite_axum example.
What's still left would be making error_template actually return the error code from the Rust error, but I wanted to get input on this app structure.
It also adds miette as a dependency, which should have a small impact on WASM size, but we should test it.