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

feat(core): default error handler #648

Merged
merged 5 commits into from
Apr 13, 2021

Conversation

squakez
Copy link
Contributor

@squakez squakez commented Apr 5, 2021

  • 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

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 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
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
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
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.

None yet

3 participants