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.
@aviau @slaroche
Add a few more advanced error handling, namely:
What the code above does is:
topic: logging-error
: Output a message to thelogging-error
topic. This message has theerror
andcause
attributes which is the error details and the original message causing the exception. One way to use this would be to have specific topic that can output to specific sentry or error logging system.set_handled: fase
: By default any error that match one of theerror:...
channel is set as "handled". This means that services like error logging or sentry will not handle them. Metric will increment aerror_handled
metric instead of the usualfailed
one. By usingset_handled: false
, the error will be reraise and the services will handle it as usual. Can be useful if we want to do something special with an error, but also use the default behavior.republish: ...
: Not the same astopic: logging-error
.republish
will publish the original message, instead of creating a new message with{"error": ..., "cause": ...}
. Therefor it can be used to publish to a queue fed to the same pipeline so it gets retried. It also set and increment aretried
metadata attribute to the message, so we can stop publishing the message after a threshold. If the message if not published because of max retried, the error is set as unhandled and should be logged or sent to sentry.