v0.0.207 renamed APIError to Error

This commit is contained in:
Julian Graf 2023-07-25 10:47:00 +02:00
parent f826633e6e
commit fb847b03af
4 changed files with 12 additions and 12 deletions

View File

@ -25,7 +25,7 @@ func Wrap(w *GinWrapper, fn WHandlerFunc) gin.HandlerFunc {
Str("trace", stackTrace). Str("trace", stackTrace).
Build() Build()
wrap = APIError(g, err) wrap = Error(g, err)
} }
if g.Writer.Written() { if g.Writer.Written() {

View File

@ -52,7 +52,7 @@ func (pctx PreContext) Start() (*AppContext, *gin.Context, *HTTPResponse) {
WithType(exerr.TypeBindFailURI). WithType(exerr.TypeBindFailURI).
Str("struct_type", fmt.Sprintf("%T", pctx.uri)). Str("struct_type", fmt.Sprintf("%T", pctx.uri)).
Build() Build()
return nil, nil, langext.Ptr(APIError(pctx.ginCtx, err)) return nil, nil, langext.Ptr(Error(pctx.ginCtx, err))
} }
} }
@ -62,7 +62,7 @@ func (pctx PreContext) Start() (*AppContext, *gin.Context, *HTTPResponse) {
WithType(exerr.TypeBindFailQuery). WithType(exerr.TypeBindFailQuery).
Str("struct_type", fmt.Sprintf("%T", pctx.query)). Str("struct_type", fmt.Sprintf("%T", pctx.query)).
Build() Build()
return nil, nil, langext.Ptr(APIError(pctx.ginCtx, err)) return nil, nil, langext.Ptr(Error(pctx.ginCtx, err))
} }
} }
@ -73,13 +73,13 @@ func (pctx PreContext) Start() (*AppContext, *gin.Context, *HTTPResponse) {
WithType(exerr.TypeBindFailJSON). WithType(exerr.TypeBindFailJSON).
Str("struct_type", fmt.Sprintf("%T", pctx.body)). Str("struct_type", fmt.Sprintf("%T", pctx.body)).
Build() Build()
return nil, nil, langext.Ptr(APIError(pctx.ginCtx, err)) return nil, nil, langext.Ptr(Error(pctx.ginCtx, err))
} }
} else { } else {
err := exerr.New(exerr.TypeBindFailJSON, "missing JSON body"). err := exerr.New(exerr.TypeBindFailJSON, "missing JSON body").
Str("struct_type", fmt.Sprintf("%T", pctx.body)). Str("struct_type", fmt.Sprintf("%T", pctx.body)).
Build() Build()
return nil, nil, langext.Ptr(APIError(pctx.ginCtx, err)) return nil, nil, langext.Ptr(Error(pctx.ginCtx, err))
} }
} }
@ -90,13 +90,13 @@ func (pctx PreContext) Start() (*AppContext, *gin.Context, *HTTPResponse) {
WithType(exerr.TypeBindFailFormData). WithType(exerr.TypeBindFailFormData).
Str("struct_type", fmt.Sprintf("%T", pctx.form)). Str("struct_type", fmt.Sprintf("%T", pctx.form)).
Build() Build()
return nil, nil, langext.Ptr(APIError(pctx.ginCtx, err)) return nil, nil, langext.Ptr(Error(pctx.ginCtx, err))
} }
} else { } else {
err := exerr.New(exerr.TypeBindFailFormData, "missing form body"). err := exerr.New(exerr.TypeBindFailFormData, "missing form body").
Str("struct_type", fmt.Sprintf("%T", pctx.form)). Str("struct_type", fmt.Sprintf("%T", pctx.form)).
Build() Build()
return nil, nil, langext.Ptr(APIError(pctx.ginCtx, err)) return nil, nil, langext.Ptr(Error(pctx.ginCtx, err))
} }
} }
@ -106,7 +106,7 @@ func (pctx PreContext) Start() (*AppContext, *gin.Context, *HTTPResponse) {
WithType(exerr.TypeBindFailHeader). WithType(exerr.TypeBindFailHeader).
Str("struct_type", fmt.Sprintf("%T", pctx.query)). Str("struct_type", fmt.Sprintf("%T", pctx.query)).
Build() Build()
return nil, nil, langext.Ptr(APIError(pctx.ginCtx, err)) return nil, nil, langext.Ptr(Error(pctx.ginCtx, err))
} }
} }

View File

@ -170,12 +170,12 @@ func Redirect(sc int, newURL string) HTTPResponse {
return &redirectHTTPResponse{statusCode: sc, url: newURL} return &redirectHTTPResponse{statusCode: sc, url: newURL}
} }
func APIError(g *gin.Context, e error) HTTPResponse { func Error(g *gin.Context, e error) HTTPResponse {
return &jsonAPIErrResponse{ return &jsonAPIErrResponse{
err: exerr.FromError(e), err: exerr.FromError(e),
} }
} }
func NotImplemented(g *gin.Context) HTTPResponse { func NotImplemented(g *gin.Context) HTTPResponse {
return APIError(g, exerr.New(exerr.TypeNotImplemented, "").Build()) return Error(g, exerr.New(exerr.TypeNotImplemented, "").Build())
} }

View File

@ -1,5 +1,5 @@
package goext package goext
const GoextVersion = "0.0.206" const GoextVersion = "0.0.207"
const GoextVersionTimestamp = "2023-07-24T18:50:14+0200" const GoextVersionTimestamp = "2023-07-25T10:47:00+0200"