mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-01 22:46:38 +08:00
autoresearch iter 2: compare error sentinels with errors.Is
Five sites used == against sentinels (redis.Nil, ingest.ErrForbidden, errs.ErrDatabaseUninitialized). The neighbouring not-found checks already went through errors.Is helpers, so a wrapped error would silently downgrade a 403 to a 400 and a 500 to a 400.
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"Wavelet/plugins/domain/admin/errs"
|
||||
"Wavelet/plugins/domain/admin/model"
|
||||
"Wavelet/plugins/domain/admin/service"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -109,7 +110,7 @@ func ExecuteSQL(c *gin.Context) {
|
||||
|
||||
resp, err := service.ExecuteCustomSQL(c.Request.Context(), trimmedSQL)
|
||||
if err != nil {
|
||||
if err == errs.ErrDatabaseUninitialized {
|
||||
if errors.Is(err, errs.ErrDatabaseUninitialized) {
|
||||
response.AbortInternal(c, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user