Skip to content

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
priteshbandi committed Jan 22, 2024
1 parent 8adc5c5 commit 3600a1a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 3 additions & 2 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ func (c *CLI) unmarshalRequest(request plugin.Request) error {

if err := request.Validate(); err != nil {
c.logger.Errorf("%s validation error :%v", reflect.TypeOf(request), err)
if e, ok := err.(*plugin.Error); ok {
return plugin.NewValidationErrorf("%s: %s", plugin.ErrorMsgMalformedInput, e.Message)
var plError *plugin.Error
if errors.As(err, &plError) {
return plugin.NewValidationErrorf("%s: %s", plugin.ErrorMsgMalformedInput, plError.Message)
}
return plugin.NewValidationErrorf("%s", plugin.ErrorMsgMalformedInput)
}
Expand Down
3 changes: 1 addition & 2 deletions plugin/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ const (
ErrorMsgMalformedOutputFmt string = "Failed to generate response. Error: %s"
)

// Error is used when the signature associated is no longer
// valid.
// Error is used to return a well-formed error response as per NotaryProject specification.
type Error struct {
ErrCode ErrorCode `json:"errorCode"`
Message string `json:"errorMessage,omitempty"`
Expand Down

0 comments on commit 3600a1a

Please sign in to comment.