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

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


The following commit(s) were added to refs/heads/main by this push:
     new fedfb5109 Enhance CamelCatalog can't be found error msg
fedfb5109 is described below

commit fedfb5109c9fd40c88e6907b25baee9f2374a10d
Author: Jan Bouska <[email protected]>
AuthorDate: Wed Aug 9 15:09:24 2023 +0200

    Enhance CamelCatalog can't be found error msg
---
 pkg/cmd/version.go | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go
index 8a40c4ac8..ee2ac2523 100644
--- a/pkg/cmd/version.go
+++ b/pkg/cmd/version.go
@@ -19,6 +19,7 @@ package cmd
 
 import (
        "context"
+       "errors"
        "fmt"
 
        v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
@@ -153,7 +154,12 @@ func operatorInfo(ctx context.Context, c client.Client, 
namespace string) (map[s
                return nil, err
        }
        if catalog == nil {
-               return nil, fmt.Errorf("CamelCatalog can't be found in %s 
namespace", platform.Namespace)
+               msg := fmt.Sprintf("CamelCatalog version: %s", 
platform.Status.Build.RuntimeVersion)
+               if platform.Status.Build.RuntimeProvider != "" {
+                       msg += fmt.Sprintf(", provider: %s", 
platform.Status.Build.RuntimeProvider)
+               }
+               msg += fmt.Sprintf(" can't be found in %s namespace", 
platform.Namespace)
+               return nil, errors.New(msg)
        }
 
        infos["Camel Quarkus version"] = 
catalog.CamelCatalogSpec.Runtime.Metadata["camel-quarkus.version"]

Reply via email to