refactored error handling in LoadKeys()
This commit is contained in:
@ -71,15 +71,15 @@ func LoadKeys(r string) (I2PKeys, error) {
|
||||
if err != nil {
|
||||
return I2PKeys{}, err
|
||||
}
|
||||
if exists {
|
||||
if !exists {
|
||||
return I2PKeys{}, fmt.Errorf("file does not exist: %s", r)
|
||||
}
|
||||
fi, err := os.Open(r)
|
||||
if err != nil {
|
||||
return I2PKeys{}, err
|
||||
return I2PKeys{}, fmt.Errorf("error opening file: %w", err)
|
||||
}
|
||||
defer fi.Close()
|
||||
return LoadKeysIncompat(fi)
|
||||
}
|
||||
return I2PKeys{}, err
|
||||
}
|
||||
|
||||
// store keys in non standard format
|
||||
|
Reference in New Issue
Block a user