mirror of
https://github.com/juanfont/headscale.git
synced 2026-08-07 07:48:44 +09:00
hscontrol/api: map missing-node errors to 404
RenameNode and ExpireNode surface ErrNodeNotInNodeStore for an unknown node; mapStateError only knew ErrNodeNotFound, so they 500'd. Treat both as not found.
This commit is contained in:
@@ -57,6 +57,7 @@ func mapStateError(err error) *oas.ErrorStatusCode {
|
||||
switch {
|
||||
case errors.Is(err, gorm.ErrRecordNotFound),
|
||||
errors.Is(err, state.ErrNodeNotFound),
|
||||
errors.Is(err, state.ErrNodeNotInNodeStore),
|
||||
errors.Is(err, db.ErrUserNotFound):
|
||||
return notFound(err.Error())
|
||||
case errors.Is(err, types.ErrPolicyUpdateIsDisabled):
|
||||
|
||||
Reference in New Issue
Block a user