refactor: replace direct error comparison with errors.Is for ErrUserNotFound

This commit is contained in:
Haitao Pan 2026-02-07 02:24:32 +08:00
parent 6117e6f769
commit 8ebc370a28
2 changed files with 4 additions and 5 deletions

View File

@ -1,6 +1,7 @@
package api
import (
"errors"
"net/http"
"strings"
"time"
@ -22,7 +23,7 @@ func (h *handler) internalSandboxGuest(c *gin.Context) {
user, err := h.store.GetUserByEmail(c.Request.Context(), sandboxUserEmail)
if err != nil {
if err == store.ErrUserNotFound {
if errors.Is(err, store.ErrUserNotFound) {
c.JSON(http.StatusNotFound, gin.H{"error": "sandbox_missing"})
return
}
@ -50,4 +51,3 @@ func (h *handler) internalSandboxGuest(c *gin.Context) {
"proxyUuidExpiresAt": expiresAt,
})
}

View File

@ -23,4 +23,3 @@ func isInternalServiceRequest(c *gin.Context) bool {
}
return token == expected
}