-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat!: Pipeline handler identifier are present in error context to support pipeline handler specific error handling strategies #239
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…n be used to attach arbitrary data (via interfaces) to errors
…a HandlerID method
… a HandlerID method, as well as to add this information as error context
…HandlerID method, as well as to add this information as error context
…lerID method, as well as to add this information as error context
…andlerID method, as well as to add this information as error context
…ia a HandlerID method, as well as to add this information as error context
Codecov Report
@@ Coverage Diff @@
## main #239 +/- ##
==========================================
- Coverage 85.26% 85.21% -0.06%
==========================================
Files 159 156 -3
Lines 6332 6383 +51
==========================================
+ Hits 5399 5439 +40
- Misses 791 810 +19
+ Partials 142 134 -8
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
dadrus
changed the title
feat!: Identifier of pipeline handlers are present in error contexts to support pipeline handler specific error handler
wip: Identifier of pipeline handlers are present in error contexts to support pipeline handler specific error handler
Sep 23, 2022
dadrus
changed the title
wip: Identifier of pipeline handlers are present in error contexts to support pipeline handler specific error handler
wip: Pipeline handler identifier are present in error context to support pipeline handler specific error handling strategies
Sep 23, 2022
dadrus
changed the title
wip: Pipeline handler identifier are present in error context to support pipeline handler specific error handling strategies
feat!: Pipeline handler identifier are present in error context to support pipeline handler specific error handling strategies
Sep 23, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
closes #97
closes #156
closes #211
closes #212
This PR updates the implementation of error handlers and enables referencing of pipeline handlers via their IDs.
Before this PR the error matching definition was:
This PR changes it to the following:
If
raised_by
(which is optional) is specified the condition is specific for the referenced pipeline handler, otherwise, the error matching happens irrespective of the pipeline handler raising the given error type.This allows implementation of different error handling strategies for the same error type in one rule for different pipeline handler. E.g. to implement two different oauth2 authentication schemes in the same rule (for the same matching url, which was not possible before this PR), one can define the handlers as follows:
and then make use of these in a rule, like follows:
With the definition above the
eh_1
error handler will only kick in if anauthentication_error
has been raised byoauth2_authenticator_1
and not any other pipeline handler. Same is true for theeh_2
error handler, which will only kick in if anauthentication_error
has been raised byoauth2_authenticator_2
.IMPORTANT: Heimdall does not verify the integrity of the pipeline handler identifiers configured using
raised_by
on start or while loading rules. Thus, if there is no pipeline handler with the given identifier, the error will not match. This limitation might be addressed in a future PR.