Skip to content

Commit

Permalink
better surfacing of errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mina1460 committed Aug 24, 2023
1 parent 3c1dfeb commit 0690c98
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/jujuapi/controllerroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (r *controllerRoot) masquerade(ctx context.Context, userTag string) (*openf
func parseUserTag(tag string) (names.UserTag, error) {
ut, err := names.ParseUserTag(tag)
if err != nil {
return names.UserTag{}, errors.E(errors.CodeBadRequest, err)
return names.UserTag{}, errors.E(errors.CodeBadRequest, err, "invalid user tag")
}
if ut.IsLocal() {
return names.UserTag{}, errors.E(errors.CodeBadRequest, "unsupported local user")
Expand Down
4 changes: 2 additions & 2 deletions internal/jujuapi/jimm.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ func (r *controllerRoot) GrantAuditLogAccess(ctx context.Context, req apiparams.

ut, err := parseUserTag(req.UserTag)
if err != nil {
return errors.E(op, err, errors.CodeBadRequest, "invalid user tag")
return errors.E(op, err, errors.CodeBadRequest)
}

err = r.jimm.GrantAuditLogAccess(ctx, r.user, ut)
Expand All @@ -414,7 +414,7 @@ func (r *controllerRoot) RevokeAuditLogAccess(ctx context.Context, req apiparams

ut, err := parseUserTag(req.UserTag)
if err != nil {
return errors.E(op, err, errors.CodeBadRequest, "invalid user tag")
return errors.E(op, err, errors.CodeBadRequest)
}

err = r.jimm.RevokeAuditLogAccess(ctx, r.user, ut)
Expand Down

0 comments on commit 0690c98

Please sign in to comment.