Skip to content

Commit

Permalink
better error message
Browse files Browse the repository at this point in the history
Signed-off-by: ALTHAF <[email protected]>
  • Loading branch information
Althaf66 committed Nov 26, 2024
1 parent 963aac0 commit f6820eb
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion cmd/harbor/root/registry/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package registry

import (
"github.com/goharbor/harbor-cli/pkg/api"
"github.com/goharbor/harbor-cli/pkg/errors"
"github.com/goharbor/harbor-cli/pkg/views/registry/create"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -37,7 +38,7 @@ func CreateRegistryCommand() *cobra.Command {
}

if err != nil {
log.Errorf("failed to create registry: %v", err)
log.Errorf("failed to create registry: %v", errors.ErrorCreateRegistry(err))
}
},
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/harbor/root/registry/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package registry

import (
"github.com/goharbor/harbor-cli/pkg/api"
"github.com/goharbor/harbor-cli/pkg/errors"
"github.com/goharbor/harbor-cli/pkg/prompt"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
Expand All @@ -25,7 +26,7 @@ func DeleteRegistryCommand() *cobra.Command {
err = api.DeleteRegistry(registryId)
}
if err != nil {
log.Errorf("failed to delete registry: %v", err)
log.Errorf("failed to delete registry: %v", errors.ErrorDeleteRegistry(err))
}
},
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/harbor/root/registry/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package registry

import (
"github.com/goharbor/harbor-cli/pkg/api"
"github.com/goharbor/harbor-cli/pkg/errors"
"github.com/goharbor/harbor-cli/pkg/prompt"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
Expand All @@ -24,7 +25,7 @@ func InfoRegistryCommand() *cobra.Command {
err = api.InfoRegistry(registryId)
}
if err != nil {
log.Errorf("failed to get registry info: %v", err)
log.Errorf("failed to get registry info: %v", errors.ErrorInfoRegistry(err))
}

},
Expand Down
3 changes: 2 additions & 1 deletion cmd/harbor/root/registry/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package registry

import (
"github.com/goharbor/harbor-cli/pkg/api"
"github.com/goharbor/harbor-cli/pkg/errors"
"github.com/goharbor/harbor-cli/pkg/utils"
"github.com/goharbor/harbor-cli/pkg/views/registry/list"
log "github.com/sirupsen/logrus"
Expand All @@ -20,7 +21,7 @@ func ListRegistryCommand() *cobra.Command {
registry, err := api.ListRegistries(opts)

if err != nil {
log.Fatalf("failed to get projects list: %v", err)
log.Fatalf("failed to get projects list: %v", errors.ErrorListRegistry(err))
}
FormatFlag := viper.GetString("output-format")
if FormatFlag != "" {
Expand Down
3 changes: 2 additions & 1 deletion cmd/harbor/root/registry/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package registry

import (
"github.com/goharbor/harbor-cli/pkg/api"
"github.com/goharbor/harbor-cli/pkg/errors"
"github.com/goharbor/harbor-cli/pkg/prompt"
"github.com/goharbor/harbor-cli/pkg/views/registry/create"
log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -51,7 +52,7 @@ func UpdateRegistryCommand() *cobra.Command {
}

if err != nil {
log.Errorf("failed to update registry: %v", err)
log.Errorf("failed to update registry: %v", errors.ErrorUpdateRegistry(err))
}
},
}
Expand Down

0 comments on commit f6820eb

Please sign in to comment.