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

server: improve error handling #387

Open
wants to merge 1 commit into
base: session-timeout
Choose a base branch
from

Conversation

conradoplg
Copy link
Contributor

Based on #375

Closes #374

This basically turns AppError into an enum, and changes previous uses of it to use specific values.

A new public Error was introduced which is effectively the JSON value returned on error, and it's what client will interact with. The AppError is converted into Error in its IntoResponse implementation, which is used by axum when converting AppError into a response.

Since clients will only see the code and msg fields, I added a const for each error enum. We might want to allow converting an Error back to an AppError for Rust clients, but I don't think we need to worry about that for now.

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.

Improve error handling; add an error enum and error cases for each common error
1 participant