Handle exceptions as annotated more #143
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Catch query-cancelled as an AnnotatedException
412b74b
Because of how our catch functions work, this will be behavior neutral
if the exception is not annotated (with a minor improvement in the
structure of the logged error message), but if/once it is annotated,
we'll include an
error.stack
value.Catch exceptions as AnnotatedException in Kafka module
d066e12
Because of how our catch functions work, this will be behavior neutral
for exceptions that not annotated (with a minor improvement in the
structure of the logged error message), but if they are annotated,
we'll now include an
error.stack
value.Add withException to Frontrow.App.Exception
187896d
Add logExceptionsMiddleware
9e5404c
We currently log all handler exceptions through the
errorHandler
member of the
Yesod
type-class. This is not ideal because it only hasaccess to an
InternalError Text
value, in which any exception hasalready been turned into its string representation. This means we get an
ugly message like
"AnnotatedException {...}"
and aren't able toactually 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 thismiddleware does. It's also what necessitated adding
withException
.