Skip to content

Commit 99433e9

Browse files
committed
[shell-operator] add StderrError type for typed stderr error handling
1 parent 7dc49f0 commit 99433e9

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pkg/executor/executor.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ func Run(cmd *exec.Cmd) error {
3535
// StderrError is returned by RunAndLogLines when a command fails and produces
3636
// output on stderr. Callers can use errors.As to access the raw stderr content.
3737
type StderrError struct {
38-
Stderr string
38+
Message string
3939
}
4040

4141
func (e *StderrError) Error() string {
42-
return fmt.Sprintf("stderr: %s", e.Stderr)
42+
return e.Message
4343
}
4444

4545
type Executor struct {
@@ -157,7 +157,7 @@ func (e *Executor) RunAndLogLines(ctx context.Context, logLabels map[string]stri
157157
err := e.cmd.Run()
158158
if err != nil {
159159
if len(stdErr.Bytes()) > 0 {
160-
return nil, &StderrError{Stderr: stdErr.String()}
160+
return nil, &StderrError{Message: stdErr.String()}
161161
}
162162

163163
return nil, fmt.Errorf("cmd run: %w", err)

0 commit comments

Comments
 (0)