From ba5a464ca5d3fcbd171c174a4f07c3326ecb01df Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Fri, 12 May 2023 08:16:41 +0000 Subject: [chore] Prefer JSON errors in API endpoints (#1766) * Default to JSON over HTML for error handling * Change the default error display for web endpoints to html --- internal/web/confirmemail.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'internal/web/confirmemail.go') diff --git a/internal/web/confirmemail.go b/internal/web/confirmemail.go index 069640ccd..b0ece58cd 100644 --- a/internal/web/confirmemail.go +++ b/internal/web/confirmemail.go @@ -32,19 +32,19 @@ func (m *Module) confirmEmailGETHandler(c *gin.Context) { // if there's no token in the query, just serve the 404 web handler token := c.Query(tokenParam) if token == "" { - apiutil.ErrorHandler(c, gtserror.NewErrorNotFound(errors.New(http.StatusText(http.StatusNotFound))), m.processor.InstanceGetV1) + apiutil.WebErrorHandler(c, gtserror.NewErrorNotFound(errors.New(http.StatusText(http.StatusNotFound))), m.processor.InstanceGetV1) return } user, errWithCode := m.processor.User().EmailConfirm(ctx, token) if errWithCode != nil { - apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1) + apiutil.WebErrorHandler(c, errWithCode, m.processor.InstanceGetV1) return } instance, err := m.processor.InstanceGetV1(ctx) if err != nil { - apiutil.ErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGetV1) + apiutil.WebErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGetV1) return } -- cgit v1.2.3