chridou / http-api-problem

A problem type to be returned by HTTP APIs
Apache License 2.0
53 stars 12 forks source link

Add `source`, `field` getters for `ApiError`. #39

Closed damooo closed 1 year ago

damooo commented 2 years ago

Currently ApiError's source and fields cannot be accessed in any way. Thus it prohibits acting based on source error, or any custom fields added by middleware. It would be useful if corresponding getters are provided.

chridou commented 2 years ago

Hi!

Thanks for your feedback!

source is provided by by the Error impl.

All fields are public so you can modify the fields as you please or am I maybe getting something wrong?

I'm considering to also add http::extensions so that typed values can be carried by the ApiError

chridou commented 2 years ago

Sorry, a bit late. Was looking at the builder ;-)

chridou commented 2 years ago

There is a draft PR (WIP): https://github.com/chridou/http-api-problem/pull/41