Introduce the `ToHumanFriendlyError` typeclass
Fixes #335 (closed).
In order to fix this, I've introduce a new typeclass called ToHumanFriendlyError
, and imposed a constraint over this class on the markFailure
and markFailed
methods of the MonadJob
class, which means that programmers are now forced to think how the error they want to send out using the Job API will be rendered to the users.
This is important not only for a better user experience, but it also gives a chance to redact sensitive data: for example showing the raw Servant' ClientError
to the user might be dangerous if some of these messages contained sensitive data like API Keys in the header response we would receive back.
Rather, the pattern should be that the raw message is logged using logLocM
in the server logs (so that we can still audit them), but we need to show to users the "friendly" version.