You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2019/02/21 06:21:16 UTC

[camel-k] branch master updated: fix(traits): ensure an error is returned to the caller if a catalog cannot be found

This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/master by this push:
     new 580794d  fix(traits): ensure an error is returned to the caller if a catalog cannot be found
580794d is described below

commit 580794da278bfae7e1ead10da2cf82b35058e149
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Wed Feb 20 17:07:49 2019 +0100

    fix(traits): ensure an error is returned to the caller if a catalog cannot be found
---
 pkg/trait/camel.go | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/pkg/trait/camel.go b/pkg/trait/camel.go
index 930b9a0..98464a4 100644
--- a/pkg/trait/camel.go
+++ b/pkg/trait/camel.go
@@ -17,7 +17,11 @@ limitations under the License.
 
 package trait
 
-import "github.com/apache/camel-k/pkg/util/camel"
+import (
+	"fmt"
+
+	"github.com/apache/camel-k/pkg/util/camel"
+)
 
 type camelTrait struct {
 	BaseTrait `property:",squash"`
@@ -51,6 +55,9 @@ func (t *camelTrait) Apply(e *Environment) error {
 			if err != nil {
 				return err
 			}
+			if c == nil {
+				return fmt.Errorf("unable to find catalog for: %s", version)
+			}
 
 			e.CamelCatalog = c
 		}
@@ -70,6 +77,9 @@ func (t *camelTrait) Apply(e *Environment) error {
 			if err != nil {
 				return err
 			}
+			if c == nil {
+				return fmt.Errorf("unable to find catalog for: %s", version)
+			}
 
 			e.CamelCatalog = c
 		}