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:
Kristoffer Dalby
2026-06-18 07:37:12 +00:00
parent c386dfe0fd
commit 18f7048c58
+1
View File
@@ -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):