MCPcopy Index your code
hub / github.com/yusing/godoxy / ErrorHandler

Function ErrorHandler

internal/api/handler.go:216–232  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

214}
215
216func ErrorHandler() gin.HandlerFunc {
217 return func(c *gin.Context) {
218 c.Next()
219 if len(c.Errors) > 0 {
220 for _, err := range c.Errors {
221 event := log.Debug()
222 if httputils.IsUnexpectedError(err) {
223 event = log.Error()
224 }
225 event.Err(err.Err).Str("uri", c.Request.RequestURI).Msg("Internal error")
226 }
227 if !c.IsWebsocket() {
228 c.JSON(http.StatusInternalServerError, apitypes.Error("Internal server error"))
229 }
230 }
231 }
232}
233
234func ErrorLoggingMiddleware() gin.HandlerFunc {
235 return gin.CustomRecoveryWithWriter(nil, func(c *gin.Context, err any) {

Callers 3

newFileContentRouterFunction · 0.92
newAPIHandlerFunction · 0.92
NewHandlerFunction · 0.85

Calls 2

ErrMethod · 0.80
ErrorMethod · 0.45

Tested by 1

newFileContentRouterFunction · 0.74