AB#2033 Remove redundant "failed" in error wrapping

Remove "failed" from wrapped errors
Where appropriate rephrase "unable to/could not" to "failed" in root
errors
Start error log messages with "Failed"
This commit is contained in:
Christoph Meyer 2022-06-09 14:04:30 +00:00 committed by cm
parent 0c9ca50be8
commit 9441e46e4b
56 changed files with 204 additions and 204 deletions

View file

@ -51,7 +51,7 @@ func (c *Cryptsetup) Open() error {
var err error
c.device, err = c.initByName(stateMapperDevice)
if err != nil {
return fmt.Errorf("unable to initialize crypt device for mapped device %q: %w", stateMapperDevice, err)
return fmt.Errorf("initializing crypt device for mapped device %q: %w", stateMapperDevice, err)
}
return nil
}
@ -96,7 +96,7 @@ func (c *Cryptsetup) UpdatePassphrase(passphrase string) error {
return err
}
if err := c.device.KeyslotChangeByPassphrase(keyslot, keyslot, initialPassphrase, passphrase); err != nil {
return fmt.Errorf("unable to change passphrase for mapped device %q: %w", stateMapperDevice, err)
return fmt.Errorf("changing passphrase for mapped device %q: %w", stateMapperDevice, err)
}
return nil
}
@ -105,7 +105,7 @@ func (c *Cryptsetup) UpdatePassphrase(passphrase string) error {
func (c *Cryptsetup) getInitialPassphrase() (string, error) {
passphrase, err := afero.ReadFile(c.fs, initialKeyPath)
if err != nil {
return "", fmt.Errorf("unable to read first boot encryption passphrase from disk: %w", err)
return "", fmt.Errorf("reading first boot encryption passphrase from disk: %w", err)
}
return string(passphrase), nil
}