refactor: use SetError in exception.Builder where errors are available
Update multiple services and middlewares to pass the original error to exception.Builder before building the error code. Co-authored-by: Gemini <gemini@google.com>
This commit is contained in:
@@ -32,6 +32,7 @@ func Checkin(c *gin.Context) {
|
||||
SetEndpoint(exception.EndpointEventServiceCheckin).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUuidParseFailed).
|
||||
SetError(err).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
}
|
||||
@@ -59,6 +60,7 @@ func Checkin(c *gin.Context) {
|
||||
SetEndpoint(exception.EndpointEventServiceCheckin).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUuidParseFailed).
|
||||
SetError(err).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
return
|
||||
@@ -72,6 +74,7 @@ func Checkin(c *gin.Context) {
|
||||
SetEndpoint(exception.EndpointEventServiceCheckin).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.EventCheckinGenCodeFailed).
|
||||
SetError(err).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
return
|
||||
@@ -98,6 +101,7 @@ func CheckinSubmit(c *gin.Context) {
|
||||
SetEndpoint(exception.EndpointEventServiceCheckinSubmit).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
SetError(err).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
return
|
||||
@@ -127,6 +131,7 @@ func CheckinQuery(c *gin.Context) {
|
||||
SetEndpoint(exception.EndpointEventServiceCheckinQuery).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUuidParseFailed).
|
||||
SetError(err).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
return
|
||||
@@ -152,6 +157,7 @@ func CheckinQuery(c *gin.Context) {
|
||||
SetEndpoint(exception.EndpointEventServiceCheckinQuery).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
SetError(err).
|
||||
Build()
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
return
|
||||
@@ -167,6 +173,7 @@ func CheckinQuery(c *gin.Context) {
|
||||
SetEndpoint(exception.EndpointEventServiceCheckinQuery).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorDatabase).
|
||||
SetError(err).
|
||||
Build()
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user