Skip to content

Commit

Permalink
chore: populate error code
Browse files Browse the repository at this point in the history
  • Loading branch information
kian99 committed Jan 15, 2025
1 parent 62a20e6 commit 113e69a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/rpcproxy/keymanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/juju/utils/v3/ssh"
gossh "golang.org/x/crypto/ssh"

"github.com/canonical/jimm/v3/internal/errors"
"github.com/canonical/jimm/v3/internal/jimm/sshkeys"
"github.com/canonical/jimm/v3/internal/openfga"
)
Expand Down Expand Up @@ -60,6 +61,7 @@ func (s *keyManagerFacade) AddKeys(ctx context.Context, args jujuparams.ModifyUs
var res []jujuparams.ErrorResult
errF := func(err error, msg string) jujuparams.ErrorResult {
return jujuparams.ErrorResult{Error: &jujuparams.Error{
Code: string(errors.ErrorCode(err)),
Message: fmt.Sprintf("%s: %s", msg, err.Error()),
}}
}
Expand Down Expand Up @@ -87,6 +89,7 @@ func (s *keyManagerFacade) DeleteKeys(ctx context.Context, args jujuparams.Modif
var res []jujuparams.ErrorResult
errF := func(err error, msg string) jujuparams.ErrorResult {
return jujuparams.ErrorResult{Error: &jujuparams.Error{
Code: string(errors.ErrorCode(err)),
Message: fmt.Sprintf("%s: %s", msg, err.Error()),
}}
}
Expand Down

0 comments on commit 113e69a

Please sign in to comment.