openfairdb
openfairdb copied to clipboard
Improve API error handling
- [x] Define the JSON shape of an API error
- [ ] Create an error struct that implements the
Respondertrait - [ ] Write / adjust tests that checks known error responses
- [ ] Implement the
Fromtrait for the new error struct
Inspiration
Rejection handler for generating uniform error responses (warp + thiserror/anyhow): https://gitlab.com/uklotzde/aoide-rs/-/blob/development/src/api/web/mod.rs#L128
BTW: https://httpstatuses.com/
This is mostly done and probably will be different when we switch to warp.