Skip to content

Commit

Permalink
Fix error handling to use os.IsNotExist (#14315)
Browse files Browse the repository at this point in the history
Co-authored-by: Radosław Kapka <[email protected]>
  • Loading branch information
gazzua and rkapka authored Aug 16, 2024
1 parent 9e9559d commit 9e25026
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions validator/accounts/wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ func IsValid(walletDir string) (bool, error) {
}
f, err := os.Open(expanded) // #nosec G304
if err != nil {
if strings.Contains(err.Error(), "no such file") ||
strings.Contains(err.Error(), "cannot find the file") ||
strings.Contains(err.Error(), "cannot find the path") {
if os.IsNotExist(err) {
return false, nil
}
return false, err
Expand Down

0 comments on commit 9e25026

Please sign in to comment.