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
@@ -5,6 +5,7 @@ import (
"honoka-chan/internal/router"
rewardschema "honoka-chan/internal/schema/reward"
"honoka-chan/internal/session"
"net/http"
"github.com/gin-gonic/gin"
)
@@ -20,7 +21,7 @@ func history(ctx *gin.Context) {
History: []any{},
},
ReleaseInfo: []any{},
StatusCode: 200,
StatusCode: http.StatusOK,
})
}
+2 -1
View File
@@ -5,6 +5,7 @@ import (
"honoka-chan/internal/router"
rewardschema "honoka-chan/internal/schema/reward"
"honoka-chan/internal/session"
"net/http"
"github.com/gin-gonic/gin"
)
@@ -21,7 +22,7 @@ func list(ctx *gin.Context) {
Items: []any{},
},
ReleaseInfo: []any{},
StatusCode: 200,
StatusCode: http.StatusOK,
})
}
+1 -1
View File
@@ -20,7 +20,7 @@ func sellUnit(ctx *gin.Context) {
ErrorCode: constant.ErrorCodeNoUnitIsSellable,
},
ReleaseInfo: []any{},
StatusCode: 600,
StatusCode: constant.ErrorCodeAcceptableError,
})
}