chore(all): review error wrappings
- remove repetitive `cannot` and `failed` prefixes - rename `unmarshaling` to `decoding`
This commit is contained in:
@@ -20,7 +20,7 @@ func (r *Routing) addIPRule(src, dst *net.IPNet, table, priority int) error {
|
||||
|
||||
existingRules, err := r.netLinker.RuleList(netlink.FAMILY_ALL)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot list rules: %w", err)
|
||||
return fmt.Errorf("listing rules: %w", err)
|
||||
}
|
||||
for i := range existingRules {
|
||||
if !rulesAreEqual(&existingRules[i], rule) {
|
||||
@@ -30,7 +30,7 @@ func (r *Routing) addIPRule(src, dst *net.IPNet, table, priority int) error {
|
||||
}
|
||||
|
||||
if err := r.netLinker.RuleAdd(rule); err != nil {
|
||||
return fmt.Errorf("cannot add rule %s: %w", rule, err)
|
||||
return fmt.Errorf("adding rule %s: %w", rule, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -47,14 +47,14 @@ func (r *Routing) deleteIPRule(src, dst *net.IPNet, table, priority int) error {
|
||||
|
||||
existingRules, err := r.netLinker.RuleList(netlink.FAMILY_ALL)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot list rules: %w", err)
|
||||
return fmt.Errorf("listing rules: %w", err)
|
||||
}
|
||||
for i := range existingRules {
|
||||
if !rulesAreEqual(&existingRules[i], rule) {
|
||||
continue
|
||||
}
|
||||
if err := r.netLinker.RuleDel(rule); err != nil {
|
||||
return fmt.Errorf("cannot delete rule %s: %w", rule, err)
|
||||
return fmt.Errorf("deleting rule %s: %w", rule, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user