File tree 1 file changed +4
-5
lines changed
1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package cli
2
2
3
3
import (
4
4
"encoding/json"
5
+ "fmt"
5
6
"os"
6
7
"strings"
7
8
@@ -34,18 +35,16 @@ func (e *Parse) Run(_ *cobra.Command, args []string) error {
34
35
35
36
// Attempt to read the file first, if that fails, try to load the URL. Finally,
36
37
// 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 {
40
40
log .Debugf ("failed to read file %s (due to %v) attempting to load the URL..." , args [0 ], err )
41
41
content , err = loader .ContentFromURL (args [0 ])
42
42
if err != nil {
43
43
return err
44
44
}
45
45
// If the content is empty and there was no error, this is not a remote file. Return the file error.
46
46
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 ])
49
48
}
50
49
}
51
50
You can’t perform that action at this time.
0 commit comments