-
-
Notifications
You must be signed in to change notification settings - Fork 419
Description
I am on LTS-16.4. So, servant-server is 0.16.2. I want to return errors like:
- unexpected runtime exception like divison on 0,
error
call and similar as HTTP 500 and some JSON object - errors thrown by me as HTTP , JSON object
- errors from REST endpoints parsing procedure (like wrong URL, missing part of the endpoint, and similar) as some HTTP code and JSON object
and I need to do it in a simple and general way, so not to do 3 different approaches for these 3 cases, but the one simple general solution. I know how to achieve 2, but I don't know how to do 1 and 2. I don't know how https://docs.servant.dev/en/stable/cookbook/custom-errors/CustomErrors.html is relevant, but as I understood already, the servant still is not for production usage , because of breaking changes: I cannot find any Servant.Server.Internal.ErrorFormatter
in my 0.16.2 version... So, my question is simple: is any adequate way to do it in servant: I suppose such obvious and simple task should be solved a long time ago and maybe it is just not described in the tutorials and documentation? If it is, then please, add some description in the tutorial - I cannot find any answer for all 3 cases in the Web, if no such a solution at all, please, write somewhere in the documentation that servant still is not for production usage.