Skip to content

Commit

Permalink
compose: Return an error when opening a file
Browse files Browse the repository at this point in the history
If the file exists, but there is an error opening it, report that to the
user instead of trying to use the API and returning a possibly confusing
error.

Related: RHEL-60124
  • Loading branch information
bcl committed Feb 13, 2025
1 parent 06dc9d6 commit 408c390
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/composer-cli/compose/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"io"
"io/fs"
"os"
"time"

Expand Down Expand Up @@ -117,6 +118,9 @@ func start(cmd *cobra.Command, args []string) error {

fmt.Printf("%s %s\n", uuid, status.Status)
}
} else if !errors.Is(err, fs.ErrNotExist) {
// File exists, but there was an error opening it
return root.ExecutionError(cmd, "reading %s - %s", args[0], err)
} else {
// 2 args is saved locally, 4 is uploaded to the specified service
if len(args) == 2 {
Expand Down

0 comments on commit 408c390

Please sign in to comment.