Closed gerardsn closed 3 years ago
@stevenvegt @reinkrul thoughts?
I think this can really improve the consistency of our REST API and I'd really like our error responses to be JSON as well. We should take care we don't introduce a massive amount of code or complexity though (while implementing). Proposal looks good, though we should discussing collapsing the builder calls;
return problem.Of(http.StatusBadRequest).Append(problem.Title("given DID could not be parsed")).Append(problem.Detail(err.Error()))
(something like that)
Also in this case, I'd say the title should identify the operation that was performed, and the detail what went wrong. Now they're a bit duplicate?
So title could be something like "can't resolve DID" and description the parser error? Or does the RFC state otherwise?
Following #3 and #9 we propose to implement RFC7807 to standardize API error handling. More specifically, define "Title", "Status", and "detail" members for each problem.
One of the current methods used is
which can be standardized using https://github.com/mschneider82/problem to something like
This will require:
Implement standard in APIs: