mirror of
https://github.com/juanfont/headscale.git
synced 2026-01-23 02:24:10 +00:00
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:
parent
1a997b6494
commit
7b4c49a91f
2 changed files with 2 additions and 2 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue