Skip to content

Commit

Permalink
Adding selective error handling
Browse files Browse the repository at this point in the history
Signed-off-by: Fritz Durchardt <[email protected]>
  • Loading branch information
Fritz Durchardt committed Aug 23, 2023
1 parent 99fd150 commit 7ae83df
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/vendir/config/lock_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ func NewLockConfigFromBytes(bs []byte) (LockConfig, error) {

func LockFileExists(path string) bool {
if _, err := os.Stat(path); err != nil {
return false
if errors.Is(err, fs.ErrNotExist) {
return false
}
panic(fmt.Errorf("can not stat file '%v': %v", path, err))
}
return true
}
Expand Down

0 comments on commit 7ae83df

Please sign in to comment.