Add context for all exceptions
Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
@@ -17,7 +17,7 @@ func ApiVersionCheck() gin.HandlerFunc {
|
||||
SetEndpoint(exception.EndpointMiddlewareService).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.ApiVersionNotFound).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpAbort(c, 400, errorCode)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ func JWTAuth() gin.HandlerFunc {
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUnauthorized).
|
||||
SetError(err).
|
||||
Build()
|
||||
Build(c)
|
||||
|
||||
utils.HttpAbort(c, 401, errorCode)
|
||||
return
|
||||
|
||||
@@ -22,7 +22,7 @@ func Permission(requiredLevel uint) gin.HandlerFunc {
|
||||
SetEndpoint(exception.EndpointMiddlewareService).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorMissingUserId).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpAbort(c, 401, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -36,7 +36,7 @@ func Permission(requiredLevel uint) gin.HandlerFunc {
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUuidParseFailed).
|
||||
SetError(err).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpAbort(c, 500, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -50,7 +50,7 @@ func Permission(requiredLevel uint) gin.HandlerFunc {
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUserNotFound).
|
||||
SetError(err).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpAbort(c, 404, errorCode)
|
||||
return
|
||||
}
|
||||
@@ -68,7 +68,7 @@ func Permission(requiredLevel uint) gin.HandlerFunc {
|
||||
SetEndpoint(exception.EndpointMiddlewareService).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorPermissionDenied).
|
||||
Build()
|
||||
Build(c)
|
||||
utils.HttpAbort(c, 403, errorCode)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user