Skip to content

Commit

Permalink
changing error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasSUSE committed Aug 7, 2024
1 parent a99cdb9 commit 24523a8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions release/charts/charts.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package charts

import (
"context"
"errors"
"fmt"
"os"
"os/exec"
Expand Down Expand Up @@ -82,14 +83,12 @@ func runChartsBuild(chartsRepoPath string, args ...string) ([]byte, error) {
cmd := exec.Command(bin, args...)
output, err := cmd.CombinedOutput()
if err != nil {
err = fmt.Errorf("error: %w; log: %s", err, output)
return nil, err
return nil, errors.New(err.Error() + ": " + string(output))
}

// Change back working dir for the caller
if err := os.Chdir(ecmWorkDir); err != nil {
err = fmt.Errorf("error: %w; log: %s", err, output)
return nil, err
return nil, errors.New(err.Error() + ": " + string(output))
}

return output, nil
Expand Down

0 comments on commit 24523a8

Please sign in to comment.