hscontrol/state: fix err113 issues using sentinel errors

Update state.go to use ErrNodeNotFound sentinel error for node
disconnect error, and debug.go to use ErrUnsupportedPolicyMode
from state.go.
This commit is contained in:
Kristoffer Dalby 2026-01-20 15:52:19 +00:00
parent 1a997b6494
commit 7b4c49a91f
2 changed files with 2 additions and 2 deletions

View file

@ -245,7 +245,7 @@ func (s *State) DebugPolicy() (string, error) {
return string(pol), nil
default:
return "", fmt.Errorf("unsupported policy mode: %s", s.cfg.Policy.Mode)
return "", fmt.Errorf("%w: %s", ErrUnsupportedPolicyMode, s.cfg.Policy.Mode)
}
}

View file

@ -500,7 +500,7 @@ func (s *State) Disconnect(id types.NodeID) ([]change.Change, error) {
})
if !ok {
return nil, fmt.Errorf("node not found: %d", id)
return nil, fmt.Errorf("%w: %d", ErrNodeNotFound, id)
}
log.Info().Uint64("node.id", id.Uint64()).Str("node.name", node.Hostname()).Msg("Node disconnected")