Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More Error Handling #332

Merged
merged 2 commits into from
Aug 8, 2023
Merged

More Error Handling #332

merged 2 commits into from
Aug 8, 2023

Conversation

isra17
Copy link
Member

@isra17 isra17 commented Aug 7, 2023

@aviau @slaroche

Add a few more advanced error handling, namely:

      error::ZeroDivisionError:
        - topic: logging-error
        - error_handler:
            set_handled: false
            republish:
              channel: default
              max_retry: 5

What the code above does is:

  • topic: logging-error: Output a message to the logging-error topic. This message has the error and cause 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 the error:... channel is set as "handled". This means that services like error logging or sentry will not handle them. Metric will increment a error_handled metric instead of the usual failed one. By using set_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 as topic: 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 a retried 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.

@isra17 isra17 requested review from aviau and slaroche August 7, 2023 19:28
@isra17 isra17 self-assigned this Aug 7, 2023
@isra17 isra17 force-pushed the isra/more-error-handling branch 2 times, most recently from f9c4bb2 to 3475317 Compare August 7, 2023 20:16
@isra17 isra17 merged commit a08b6de into main Aug 8, 2023
3 checks passed
@isra17 isra17 deleted the isra/more-error-handling branch August 8, 2023 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant