Skip to content

Commit

Permalink
cleanup: only use returnErr when non-nil
Browse files Browse the repository at this point in the history
  • Loading branch information
zshipko committed Nov 20, 2024
1 parent 6743e91 commit 97e31e7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion extism.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,12 @@ func (p *Plugin) CallWithContext(ctx context.Context, name string, data []byte)

output, err := p.GetOutputWithContext(ctx)
if err != nil {
return rc, []byte{}, errors.Join(returnErr, fmt.Errorf("failed to get output: %v", err))
e := fmt.Errorf("failed to get output: %v", err)
if returnErr != nil {
return rc, []byte{}, errors.Join(returnErr, e)
} else {
return rc, []byte{}, e
}
}

return rc, output, returnErr
Expand Down

0 comments on commit 97e31e7

Please sign in to comment.