You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnfmt.Errorf("%s does not exist, initialize config with horcrux config init and try again", config.HomeDir)
}
assumes that the only error ever will be os.IsNotExist but there is a huge variety of errors that can be returned especially in tools like this that can be deployed on containers
Suggestion
Check for other errors if not nil and handle them appropriately like this
switch_, err:=os.Stat(config.HomeDir); {
caseerr==nil:
// Do nothing here.caseos.IsNotExist(err):
returnfmt.Errorf("%s does not exist, initialize config with horcrux config init and try again", config.HomeDir)
default:
returnfmt.Errorf("%w unhandled error", err)
}
The text was updated successfully, but these errors were encountered:
jonathanpberger
changed the title
cmd/horcrux: showStateCmd only checks for non-existent errors but others could lurk and cause unintelligible results
cmd/horcrux: showStateCmd should check for errors other than os.IsNotExistMar 21, 2023
This code in here
horcrux/cmd/horcrux/cmd/state.go
Lines 33 to 36 in 0ba5fda
assumes that the only error ever will be os.IsNotExist but there is a huge variety of errors that can be returned especially in tools like this that can be deployed on containers
Suggestion
Check for other errors if not nil and handle them appropriately like this
The text was updated successfully, but these errors were encountered: