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
func (a Wrapper) GetDID(ctx echo.Context, did string) error {
d, err := did2.ParseDID(did)
if err != nil {
return ctx.String(http.StatusBadRequest, fmt.Sprintf("given DID could not be parsed: %s", err.Error()))
}
...
}
which can be standardized using https://github.com/mschneider82/problem to something like
func (a Wrapper) GetDID(ctx echo.Context, did string) error {
d, err := did2.ParseDID(did)
if err != nil {
p := problem.Of(http.StatusBadRequest)
p.Append(problem.Title("given DID could not be parsed"))
p.Append(problem.Detail(err.Error()))
return p
}
...
}
This will require:
Implement standard in APIs:
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: