Add context for all exceptions

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-01-21 19:37:20 +08:00
parent 154c929859
commit 986f63c0af
16 changed files with 91 additions and 87 deletions

View File

@@ -31,7 +31,7 @@ func Magic(c *gin.Context) {
SetType(exception.TypeCommon).
SetOriginal(exception.CommonErrorInvalidInput).
SetError(err).
Build()
Build(c)
utils.HttpResponse(c, 400, errorCode)
return
}
@@ -46,7 +46,7 @@ func Magic(c *gin.Context) {
SetType(exception.TypeSpecific).
SetOriginal(exception.AuthMagicTurnstileFailed).
SetError(err).
Build()
Build(c)
utils.HttpResponse(c, 403, errorCode)
return
}
@@ -60,7 +60,7 @@ func Magic(c *gin.Context) {
SetType(exception.TypeSpecific).
SetOriginal(exception.AuthMagicCodeGenFailed).
SetError(err).
Build()
Build(c)
utils.HttpResponse(c, 500, errorCode)
return
}
@@ -75,7 +75,7 @@ func Magic(c *gin.Context) {
SetType(exception.TypeSpecific).
SetOriginal(exception.AuthMagicInvalidExternalUrl).
SetError(err).
Build()
Build(c)
utils.HttpResponse(c, 500, errorCode)
return
}
@@ -106,7 +106,7 @@ func Magic(c *gin.Context) {
SetType(exception.TypeSpecific).
SetOriginal(exception.AuthMagicInvalidEmailConfig).
SetError(err).
Build()
Build(c)
utils.HttpResponse(c, 500, errorCode)
return
}
@@ -124,6 +124,6 @@ func Magic(c *gin.Context) {
SetEndpoint(exception.EndpointAuthServiceMagic).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonSuccess).
Build()
Build(c)
utils.HttpResponse(c, 200, errorCode)
}