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
@@ -9,6 +9,7 @@ import (
unitschema "honoka-chan/internal/schema/unit"
"honoka-chan/internal/session"
honokautils "honoka-chan/internal/utils"
"net/http"
"time"
"github.com/gin-gonic/gin"
@@ -101,7 +102,7 @@ func deck(ctx *gin.Context) {
ss.Respond(unitschema.DeckResp{
ResponseData: []any{},
ReleaseInfo: []any{},
StatusCode: 200,
StatusCode: http.StatusOK,
})
}
+2 -1
View File
@@ -7,6 +7,7 @@ import (
unitschema "honoka-chan/internal/schema/unit"
"honoka-chan/internal/session"
honokautils "honoka-chan/internal/utils"
"net/http"
"github.com/gin-gonic/gin"
)
@@ -40,7 +41,7 @@ func deckName(ctx *gin.Context) {
ss.Respond(unitschema.DeckResp{
ResponseData: []any{},
ReleaseInfo: []any{},
StatusCode: 200,
StatusCode: http.StatusOK,
})
}
+2 -1
View File
@@ -7,6 +7,7 @@ import (
unitschema "honoka-chan/internal/schema/unit"
"honoka-chan/internal/session"
honokautils "honoka-chan/internal/utils"
"net/http"
"github.com/gin-gonic/gin"
)
@@ -33,7 +34,7 @@ func favorite(ctx *gin.Context) {
ss.Respond(unitschema.FavoriteResp{
ResponseData: []any{},
ReleaseInfo: []any{},
StatusCode: 200,
StatusCode: http.StatusOK,
})
}
+2 -1
View File
@@ -5,6 +5,7 @@ import (
"honoka-chan/internal/middleware"
"honoka-chan/internal/router"
"honoka-chan/internal/session"
"net/http"
"github.com/gin-gonic/gin"
)
@@ -24,7 +25,7 @@ func favoriteAccessory(ctx *gin.Context) {
ss.Respond(SetResp{
ResponseData: []any{},
ReleaseInfo: []any{},
StatusCode: 200,
StatusCode: http.StatusOK,
})
}
@@ -6,6 +6,7 @@ import (
unitschema "honoka-chan/internal/schema/unit"
"honoka-chan/internal/session"
honokautils "honoka-chan/internal/utils"
"net/http"
"github.com/gin-gonic/gin"
)
@@ -48,7 +49,7 @@ func removableSkillEquipment(ctx *gin.Context) {
ss.Respond(unitschema.RemovableSkillEquipmentResp{
ResponseData: []any{},
ReleaseInfo: []any{},
StatusCode: 200,
StatusCode: http.StatusOK,
})
}
+2 -1
View File
@@ -7,6 +7,7 @@ import (
unitschema "honoka-chan/internal/schema/unit"
"honoka-chan/internal/session"
honokautils "honoka-chan/internal/utils"
"net/http"
"time"
"github.com/gin-gonic/gin"
@@ -90,7 +91,7 @@ func sale(ctx *gin.Context) {
ServerTimestamp: time.Now().Unix(),
},
ReleaseInfo: []any{},
StatusCode: 200,
StatusCode: http.StatusOK,
})
}
+2 -1
View File
@@ -7,6 +7,7 @@ import (
unitschema "honoka-chan/internal/schema/unit"
"honoka-chan/internal/session"
honokautils "honoka-chan/internal/utils"
"net/http"
"github.com/gin-gonic/gin"
)
@@ -33,7 +34,7 @@ func setDisplayRank(ctx *gin.Context) {
ss.Respond(unitschema.SetDisplayRankResp{
ResponseData: []any{},
ReleaseInfo: []any{},
StatusCode: 200,
StatusCode: http.StatusOK,
})
}
+2 -1
View File
@@ -8,6 +8,7 @@ import (
unitschema "honoka-chan/internal/schema/unit"
"honoka-chan/internal/session"
honokautils "honoka-chan/internal/utils"
"net/http"
"github.com/gin-gonic/gin"
)
@@ -62,7 +63,7 @@ func wearAccessory(ctx *gin.Context) {
ss.Respond(unitschema.WearAccessoryResp{
ResponseData: []any{},
ReleaseInfo: []any{},
StatusCode: 200,
StatusCode: http.StatusOK,
})
}