Skip to content

Commit

Permalink
fix(cmd/bind): nullable error-handler
Browse files Browse the repository at this point in the history
Using a pointer in order to admit an empty value instead of a null when marshalling the KameletBindingSpec

Closes #2493
  • Loading branch information
squakez committed Jul 12, 2021
1 parent d9230bd commit 597adde
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/apis/camel/v1alpha1/kamelet_binding_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type KameletBindingSpec struct {
// Sink is the destination of the integration defined by this binding
Sink Endpoint `json:"sink,omitempty"`
// ErrorHandler is an optional handler called upon an error occuring in the integration
ErrorHandler ErrorHandlerSpec `json:"errorHandler,omitempty"`
ErrorHandler *ErrorHandlerSpec `json:"errorHandler,omitempty"`
// Steps contains an optional list of intermediate steps that are executed between the Source and the Sink
Steps []Endpoint `json:"steps,omitempty"`
}
Expand Down
6 changes: 5 additions & 1 deletion pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/controller/kameletbinding/error_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import (
"github.com/pkg/errors"
)

func maybeErrorHandler(errHandlConf v1alpha1.ErrorHandlerSpec, bindingContext bindings.BindingContext) (*bindings.Binding, error) {
func maybeErrorHandler(errHandlConf *v1alpha1.ErrorHandlerSpec, bindingContext bindings.BindingContext) (*bindings.Binding, error) {
var errorHandlerBinding *bindings.Binding
if errHandlConf.RawMessage != nil {
if errHandlConf != nil && &errHandlConf.RawMessage != nil {
errorHandlerSpec, err := parseErrorHandler(errHandlConf.RawMessage)
if err != nil {
return nil, errors.Wrap(err, "could not parse error handler")
Expand Down

0 comments on commit 597adde

Please sign in to comment.