for-GET/jesse

add jesse:error_to_json

Closed this issue · 3 comments

Port of klarna/jesse#38 by @Licenser


Hi, I was thinking it'd be really nice to have a pre-build function that formats the erlang error into a json error to return to the sender.

It probably can be done easily in the application using jesse but it seems such a common thing that I feel like it could be included directly?

-spec error_to_json([jesse:error()]) -> binary().
%% ...
something like that?

+1

@marutha @Licenser happy to review a PR on this if you already have smth up and running, but, personally, after doing this over the weekend (branch not pushed), I will definitely prioritize #6 and only when that is done, implement this feature as ~fun jesse_error:to_json/1