Skip to content

Commit

Permalink
fix: update error message (#14)
Browse files Browse the repository at this point in the history
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
  • Loading branch information
JeyJeyGao committed Jan 25, 2024
1 parent 113b0ed commit ef1051f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ func (c *CLI) validateArgs(ctx context.Context, args []string) {
// unmarshalRequest reads input from std.in and unmarshal it into given request struct
func (c *CLI) unmarshalRequest(request plugin.Request) error {
if err := json.NewDecoder(os.Stdin).Decode(request); err != nil {
c.logger.Errorf("%s unmarshalling error :%v", reflect.TypeOf(request), err)
c.logger.Errorf("%s unmarshalling error: %v", reflect.TypeOf(request), err)
return plugin.NewJSONParsingError(plugin.ErrorMsgMalformedInput)
}

if err := request.Validate(); err != nil {
c.logger.Errorf("%s validation error :%v", reflect.TypeOf(request), err)
c.logger.Errorf("%s validation error: %v", reflect.TypeOf(request), err)
var plError *plugin.Error
if errors.As(err, &plError) {
return plugin.NewValidationErrorf("%s: %s", plugin.ErrorMsgMalformedInput, plError.Message)
Expand All @@ -155,7 +155,7 @@ func (c *CLI) unmarshalRequest(request plugin.Request) error {
func (c *CLI) getMetadata(ctx context.Context, p plugin.Plugin) *plugin.GetMetadataResponse {
md, err := p.GetMetadata(ctx, &plugin.GetMetadataRequest{})
if err != nil {
c.logger.Errorf("GetMetadataRequest error :%v", err)
c.logger.Errorf("GetMetadataRequest error: %v", err)
deliverError("Error: Failed to get plugin metadata.")
}
return md
Expand Down

0 comments on commit ef1051f

Please sign in to comment.