MCPcopy Create free account
hub / github.com/devfeel/dotweb / DefaultHTTPErrorHandler

Method DefaultHTTPErrorHandler

dotweb.go:656–665  ·  view source on GitHub ↗

DefaultHTTPErrorHandler default exception handler

(ctx Context, err error)

Source from the content-addressed store, hash-verified

654
655// DefaultHTTPErrorHandler default exception handler
656func (app *DotWeb) DefaultHTTPErrorHandler(ctx Context, err error) {
657 ctx.Response().Header().Set(HeaderContentType, CharsetUTF8)
658 // if in development mode, output the error info
659 if app.IsDevelopmentMode() {
660 stack := string(debug.Stack())
661 ctx.WriteStringC(http.StatusInternalServerError, fmt.Sprintln(err)+stack)
662 } else {
663 ctx.WriteStringC(http.StatusInternalServerError, "Internal Server Error")
664 }
665}
666
667func (app *DotWeb) printDotLogo() {
668 app.Logger().Print(` ____ __ __`, LogTarget_HttpServer)

Callers

nothing calls this directly

Calls 5

IsDevelopmentModeMethod · 0.95
SetMethod · 0.65
ResponseMethod · 0.65
WriteStringCMethod · 0.65
HeaderMethod · 0.45

Tested by

no test coverage detected