Skip to content

Commit

Permalink
feat(cmd/influx): add hints to ID-related errors in DBRP CLI commands
Browse files Browse the repository at this point in the history
  • Loading branch information
danxmoran committed Nov 30, 2020
1 parent 5b29ef7 commit 0e63a44
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/influx/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ func (o *organization) getID(orgSVC influxdb.OrganizationService) (influxdb.ID,
if o.id != "" {
influxOrgID, err := influxdb.IDFromString(o.id)
if err != nil {
return 0, fmt.Errorf("invalid org ID provided: %s", err.Error())
return 0, fmt.Errorf("invalid org ID '%s' provided: %w (did you pass an org name instead of an ID?)", o.id, err)
}
return *influxOrgID, nil
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/influx/v1_authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func makeV1AuthorizationCreateE(opt genericCLIOpts) func(*cobra.Command, []strin
for _, p := range bp.perms {
var id influxdb.ID
if err := id.DecodeFromString(p); err != nil {
return err
return fmt.Errorf("invalid bucket ID '%s': %w (did you pass a bucket name instead of an ID?)", p, err)
}

p, err := influxdb.NewPermissionAtID(id, bp.action, influxdb.BucketsResourceType, orgID)
Expand Down

0 comments on commit 0e63a44

Please sign in to comment.