Skip to content

feat(core): default error handler - #648

Merged
lburgazzoli merged 5 commits into
apache:masterfrom
squakez:feat/kameletbinding_error_handler
Apr 13, 2021
Merged

lburgazzoli merged 5 commits into
apache:masterfrom
squakez:feat/kameletbinding_error_handler

Conversation

@squakez

@squakez squakez commented Apr 5, 2021 •

Copy link
Copy Markdown
Contributor
  • Introduced a new SourceType, errorHandler, that can be used as a source for spotting a default error handler that will be used in those routes that don't specify any
  • Forced the sources sorting in order to load errorHandler first, sources and templates
  • Added a check to make sure only one error handler is provided

I've changed a little bit the first commit in order to avoid re-loading the source. Adding a new SourceType and make it load the very first will allow Camel K operator to specify the error-handler Kamelet just once.

Release Note

feat(core): default error handler

squakez added 2 commits April 13, 2021 12:46
Adding a new configurer that will look for a camel.k.global-error-handler property that can be used to set a default global error handler. Any route builder will inherit this error handler unless it is explicitly specified.
* Introduced a new SourceType, errorHandler, that can be used as a source for spotting a default error handler that will be used in those routes that don't specify any
* Forced the sources sorting in order to load errorHandler first, sources and templates
* Added a check to make sure only one error handler is provided
@squakez
squakez force-pushed the feat/kameletbinding_error_handler branch from 3266051 to 00121eb Compare April 13, 2021 10:46
@squakez squakez changed the title feat(core): global default error handler feat(core): default error handler Apr 13, 2021
@squakez
squakez requested a review from lburgazzoli April 13, 2021 10:50
@squakez
squakez force-pushed the feat/kameletbinding_error_handler branch from a2ac53a to d3236de Compare April 13, 2021 13:34
@squakez
squakez force-pushed the feat/kameletbinding_error_handler branch from d3236de to 088c3cd Compare April 13, 2021 14:11
return;
}
// We must ensure the source order as defined in SourceType enum
Arrays.sort(sources,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think getType should never return null so maybe we should add some validation and then this can maybe simplified with something like:

Arrays.sort(source, Comparator.comparing(SourceDefinition::getType))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I had to introduce those checks because there were a few unit test failing and also the real integration. I think the root cause may be within camel k which leaves that field blank. However, it will need a bit more of investigation. Are you okey if I open a follow up issue and we keep this ahead?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

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.

3 participants