Unify error handling and HTTP statuses
Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package achievement
|
||||
import (
|
||||
achievementapischema "honoka-chan/internal/schema/api/achievement"
|
||||
"honoka-chan/internal/session"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -37,7 +38,7 @@ func initialAccomplishedList(ctx *gin.Context) (res any, err error) {
|
||||
|
||||
return achievementapischema.UnaccomplishListResp{
|
||||
Result: listData,
|
||||
Status: 200,
|
||||
Status: http.StatusOK,
|
||||
CommandNum: false,
|
||||
TimeStamp: time.Now().Unix(),
|
||||
}, nil
|
||||
|
||||
@@ -2,6 +2,7 @@ package achievement
|
||||
|
||||
import (
|
||||
achievementapischema "honoka-chan/internal/schema/api/achievement"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -18,7 +19,7 @@ func unaccomplishList() (res any, err error) {
|
||||
|
||||
res = achievementapischema.UnaccomplishListResp{
|
||||
Result: listData,
|
||||
Status: 200,
|
||||
Status: http.StatusOK,
|
||||
CommandNum: false,
|
||||
TimeStamp: time.Now().Unix(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user