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

fix(service-registry create): improve error handling #1814

Merged
merged 1 commit into from
Feb 23, 2023
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
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ require (

require (
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/accountmgmt/apiv1/client v0.0.0-20230216114230-4ff0373de47f
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/connectormgmt v0.0.0-20230220160753-3c2c52e7e98a
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/kafkainstance v0.0.0-20230220160753-3c2c52e7e98a
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/connectormgmt v0.0.0-20230222114134-d97c4c88765b
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/kafkainstance v0.0.0-20230222114134-d97c4c88765b
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/kafkamgmt v0.0.0-20230220160753-3c2c52e7e98a
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/registryinstance v0.0.0-20230220160753-3c2c52e7e98a
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/registrymgmt v0.0.0-20230220160753-3c2c52e7e98a
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/serviceaccountmgmt v0.0.0-20230220160753-3c2c52e7e98a
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/registryinstance v0.0.0-20230222114134-d97c4c88765b
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/registrymgmt v0.0.0-20230222114134-d97c4c88765b
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/serviceaccountmgmt v0.0.0-20230222114134-d97c4c88765b
)

require (
Expand Down Expand Up @@ -96,7 +96,7 @@ require (
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.26.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go v0.1.0 // indirect
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go v0.2.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/segmentio/backo-go v0.0.0-20200129164019-23eae7c10bd3 // indirect
Expand Down
23 changes: 12 additions & 11 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -691,22 +691,23 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O
github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4=
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go v0.1.0 h1:bl64y8lVc+rcda483ZvJr+GjuhsQQhkrzUiDfzPjB4Q=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go v0.1.0/go.mod h1:JPNDOitDoHoHk5ZPRjfOxHQhE4Br0WtiyV8m43E0rso=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go v0.2.0 h1:N2FoVU7tD8S94+xmgYDOfbLJpZz4o6bVoub7D/jFWC4=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go v0.2.0/go.mod h1:JPNDOitDoHoHk5ZPRjfOxHQhE4Br0WtiyV8m43E0rso=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/accountmgmt/apiv1/client v0.0.0-20230216114230-4ff0373de47f h1:jXUB35TstK4p1JkhMTU0xGRsoNlnwffv4qX9E3LRMck=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/accountmgmt/apiv1/client v0.0.0-20230216114230-4ff0373de47f/go.mod h1:I2ayTdtOFVLwyASlzvbnKaz23v9c/GiJazXek2k1yUg=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/connectormgmt v0.0.0-20230220160753-3c2c52e7e98a h1:8viwGaF7yMMYX1RJTkH7DUkhuND9b2v0LaPcrIoYWs0=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/connectormgmt v0.0.0-20230220160753-3c2c52e7e98a/go.mod h1:gK7/wdWr89PXSQbJ/KlaBVMdspFkDboi8yQqVuM5Ke0=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/kafkainstance v0.0.0-20230220160753-3c2c52e7e98a h1:k2wz3MgCKzTbOSvhSRD0hXjgfgMzarRZP528kCpcH1E=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/kafkainstance v0.0.0-20230220160753-3c2c52e7e98a/go.mod h1:eJWRq/utm2rgeF/CVTeiMdlUAlEoYE5P3/13KAJyaL8=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/connectormgmt v0.0.0-20230222114134-d97c4c88765b h1:ZbZfNu6+bP2Im8ZIhC3d7yE/SthmuTc5tpvoYBHh8kM=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/connectormgmt v0.0.0-20230222114134-d97c4c88765b/go.mod h1:gK7/wdWr89PXSQbJ/KlaBVMdspFkDboi8yQqVuM5Ke0=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/kafkainstance v0.0.0-20230222114134-d97c4c88765b h1:XL00la+2TXfgI5NibnqlM/2y44FrQv7N/XKqgPYxSqU=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/kafkainstance v0.0.0-20230222114134-d97c4c88765b/go.mod h1:eJWRq/utm2rgeF/CVTeiMdlUAlEoYE5P3/13KAJyaL8=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/kafkamgmt v0.0.0-20230220160753-3c2c52e7e98a h1:LhFKr0iCPdEUSaIzrl+2Y6CXqV5fkfUktwCDnH2wdeQ=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/kafkamgmt v0.0.0-20230220160753-3c2c52e7e98a/go.mod h1:AHZLQfBqzwY+uDWfo577AipCpnFPG4GNXTnXyWeFKD4=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/registryinstance v0.0.0-20230220160753-3c2c52e7e98a h1:VMkueGJm/lHF0SmNUrUYqrwQzquahX3ZkjUdOll2j+4=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/registryinstance v0.0.0-20230220160753-3c2c52e7e98a/go.mod h1:Pvw6KeJUK9tdvCHkDIoXcWUyjxWc3Nn//Eax2mcbMJ0=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/registrymgmt v0.0.0-20230220160753-3c2c52e7e98a h1:t0a5qZfNfRjw2fKlyzM878cZOGIpfjLHKJ9jw3y61Ak=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/registrymgmt v0.0.0-20230220160753-3c2c52e7e98a/go.mod h1:T20A1WmLYXFpA5QntaAF1B44uj9geAgUbTco0qIX7kY=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/serviceaccountmgmt v0.0.0-20230220160753-3c2c52e7e98a h1:tkIWnEabTTum0iB2mPVAJVdPES296Qo5qPxeBZnzwBY=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/serviceaccountmgmt v0.0.0-20230220160753-3c2c52e7e98a/go.mod h1:9UjE86bWDvSfAwSAqweZPRNEAjAgI0ZvKYMIoz06qd0=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/registryinstance v0.0.0-20230222114134-d97c4c88765b h1:fz4sahm2HQq5dJV7M8LUldosM2RAXzVthn6pUEBSeFM=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/registryinstance v0.0.0-20230222114134-d97c4c88765b/go.mod h1:Pvw6KeJUK9tdvCHkDIoXcWUyjxWc3Nn//Eax2mcbMJ0=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/registrymgmt v0.0.0-20230222114134-d97c4c88765b h1:tYahCNjxLYtikqnhIdbGyEP+zZ2bkEtxnpJQhN0Se6s=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/registrymgmt v0.0.0-20230222114134-d97c4c88765b/go.mod h1:T20A1WmLYXFpA5QntaAF1B44uj9geAgUbTco0qIX7kY=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/serviceaccountmgmt v0.0.0-20230222114134-d97c4c88765b h1:+4KWvTNPiEaz7f8Nncbkyag9MEO9u22d2ijrojAwP1c=
github.com/redhat-developer/app-services-sdk-core/app-services-sdk-go/serviceaccountmgmt v0.0.0-20230222114134-d97c4c88765b/go.mod h1:9UjE86bWDvSfAwSAqweZPRNEAjAgI0ZvKYMIoz06qd0=
github.com/redhat-developer/service-binding-operator v0.9.0 h1:CS+eEtzu/PtWuyvYQFQpZXd6ukSuFtN+U0EKKtTsvlA=
github.com/redhat-developer/service-binding-operator v0.9.0/go.mod h1:D415gZQiz5Q8zyRbmrNrlieb6Xp73oFtCb+nCuTL6GA=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
Expand Down
3 changes: 3 additions & 0 deletions pkg/cmd/registry/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ func handleErrors(err error, opts *options) error {
if srsmgmtv1errors.IsAPIError(err, srsmgmtv1errors.ERROR_7) {
return opts.localizer.MustLocalizeError("registry.cmd.create.error.limitreached")
}
if srsmgmtv1errors.IsAPIError(err, srsmgmtv1errors.ERROR_9) {
return opts.localizer.MustLocalizeError("registry.cmd.create.error.name.alreadyExists", localize.NewEntry("Name", opts.name))
}
if srsmgmtv1errors.IsAPIError(err, srsmgmtv1errors.ERROR_13) {
return opts.localizer.MustLocalizeError("registry.cmd.create.error.trial.limitreached")
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/core/localize/locales/en/cmd/registry_crud.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ one = '''
Instance cannot be created. We have reached global the limit of service registry instances.
'''

[registry.cmd.create.error.name.alreadyExists]
one = 'Instance with name "{{.Name}}" already exists'

[registry.cmd.create.flag.use.description]
one = 'Set the new Service Registry instance to the current instance'
Expand Down

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

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

Loading