Unify error handling and HTTP statuses

Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
2026-07-11 16:18:17 +08:00
parent 61b33ae0e3
commit cb8f587e30
113 changed files with 408 additions and 166 deletions
+2 -1
View File
@@ -6,6 +6,7 @@ import (
secretboxschema "honoka-chan/internal/schema/secretbox"
"honoka-chan/internal/session"
honokautils "honoka-chan/internal/utils"
"net/http"
"github.com/gin-gonic/gin"
)
@@ -28,7 +29,7 @@ func multi(ctx *gin.Context) {
ss.Respond(secretboxschema.MultiResp{
ResponseData: data,
ReleaseInfo: []any{},
StatusCode: 200,
StatusCode: http.StatusOK,
})
}
+2 -1
View File
@@ -10,6 +10,7 @@ import (
"honoka-chan/internal/session"
honokautils "honoka-chan/internal/utils"
"math/rand"
"net/http"
"time"
"github.com/gin-gonic/gin"
@@ -33,7 +34,7 @@ func pon(ctx *gin.Context) {
ss.Respond(secretboxschema.PonResp{
ResponseData: data,
ReleaseInfo: []any{},
StatusCode: 200,
StatusCode: http.StatusOK,
})
}
+2 -1
View File
@@ -7,6 +7,7 @@ import (
"honoka-chan/internal/session"
honokautils "honoka-chan/internal/utils"
"honoka-chan/pkg/db"
"net/http"
"sort"
"time"
)
@@ -21,7 +22,7 @@ func loadSecretBoxAllData() (secretboxapischema.AllResp, error) {
return secretboxapischema.AllResp{
Result: data,
Status: 200,
Status: http.StatusOK,
CommandNum: false,
TimeStamp: time.Now().Unix(),
}, nil
+2 -1
View File
@@ -7,6 +7,7 @@ import (
secretboxschema "honoka-chan/internal/schema/secretbox"
"honoka-chan/internal/session"
honokautils "honoka-chan/internal/utils"
"net/http"
"github.com/gin-gonic/gin"
)
@@ -29,7 +30,7 @@ func showDetail(ctx *gin.Context) {
ss.Respond(secretboxschema.ShowDetailResp{
ResponseData: data,
ReleaseInfo: []any{},
StatusCode: 200,
StatusCode: http.StatusOK,
})
}