openfairdb icon indicating copy to clipboard operation
openfairdb copied to clipboard

Improve API error handling

Open flosse opened this issue 5 years ago • 2 comments

  • [x] Define the JSON shape of an API error
  • [ ] Create an error struct that implements the Responder trait
  • [ ] Write / adjust tests that checks known error responses
  • [ ] Implement the From trait for the new error struct

flosse avatar Nov 12 '20 14:11 flosse

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

uklotzde avatar Jan 14 '21 11:01 uklotzde

BTW: https://httpstatuses.com/

flosse avatar Jul 22 '21 14:07 flosse

This is mostly done and probably will be different when we switch to warp.

flosse avatar Jan 21 '23 17:01 flosse