Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We currently log all handler exceptions through the `errorHandler` member of the `Yesod` type-class. This is not ideal because it only has access to an `InternalError Text` value, in which any exception has already been turned into its string representation. This means we get an ugly message like `"AnnotatedException {...}"` and aren't able to actually construct a structured log. We should stop doing that, and recover that logging by adding a Yesod middleware that catches, logs, and re-throws all exceptions instead. Then it can be handled as an actual (annotated) exception, and produce a nice, structured log message (i.e. with `error.stack`). That's what this middleware does. It's also what necessitated adding `withException`.
- Loading branch information