Skip to content

Commit 3e9de59

Browse files
committed
fix: change error message for failed loading
Signed-off-by: tylerslaton <[email protected]>
1 parent 201e5f2 commit 3e9de59

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pkg/cli/parse.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cli
22

33
import (
44
"encoding/json"
5+
"fmt"
56
"os"
67
"strings"
78

@@ -34,18 +35,16 @@ func (e *Parse) Run(_ *cobra.Command, args []string) error {
3435

3536
// Attempt to read the file first, if that fails, try to load the URL. Finally,
3637
// return an error if both fail.
37-
var fileErr error
38-
content, fileErr = input.FromFile(args[0])
39-
if fileErr != nil {
38+
content, err = input.FromFile(args[0])
39+
if err != nil {
4040
log.Debugf("failed to read file %s (due to %v) attempting to load the URL...", args[0], err)
4141
content, err = loader.ContentFromURL(args[0])
4242
if err != nil {
4343
return err
4444
}
4545
// If the content is empty and there was no error, this is not a remote file. Return the file error.
4646
if content == "" {
47-
log.Debugf("no content found for %s, returning original error.", args[0])
48-
return fileErr
47+
return fmt.Errorf("failed to load %v", args[0])
4948
}
5049
}
5150

0 commit comments

Comments
 (0)