Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/core/localize/locales/en/cmd/context.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,13 @@ Your instance might have been removed.
You can update your context by creating a new instance or by using the "rhoas context set-kafka" command
'''

[context.common.error.namespace.notFound]
one='''
Connector namespace in your context does not exist.
Your connector namespace might have been removed.
You can set a namespace in the current context by creating a new connector namespace or by using the "rhoas context set-namespace" command
'''

[context.common.error.context.notFound]
one='''
context with name "{{.Name}}" does not exist
Expand Down
11 changes: 9 additions & 2 deletions pkg/shared/contextutil/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package contextutil

import (
"context"

"github.com/redhat-developer/app-services-cli/pkg/core/localize"
"github.com/redhat-developer/app-services-cli/pkg/core/servicecontext"

"github.com/redhat-developer/app-services-cli/pkg/shared/connection"
"github.com/redhat-developer/app-services-cli/pkg/shared/factory"
connectormgmtclient "github.com/redhat-developer/app-services-sdk-go/connectormgmt/apiv1/client"
connectorerror "github.com/redhat-developer/app-services-sdk-go/connectormgmt/apiv1/error"
srsmgmtv1errors "github.com/redhat-developer/app-services-sdk-go/registrymgmt/apiv1/error"

registrymgmtclient "github.com/redhat-developer/app-services-sdk-go/registrymgmt/apiv1/client"
Expand Down Expand Up @@ -187,9 +189,14 @@ func GetNamespaceForServiceConfig(currCtx *servicecontext.ServiceConfig, conn *c

namespace, _, err := (*conn).API().ConnectorsMgmt().ConnectorNamespacesApi.GetConnectorNamespace(f.Context, currCtx.NamespaceID).Execute()
if err != nil {
return nil, err
}
if apiErr := connectorerror.GetAPIError(err); apiErr != nil {
if apiErr.GetCode() == connectorerror.ERROR_7 {
return nil, f.Localizer.MustLocalizeError("context.common.error.namespace.notFound")
}

return nil, err
}
}
return &namespace, err
}

Expand Down