MCPcopy Create free account
hub / github.com/gogs/gogs / Error

Method Error

internal/context/context.go:166–176  ·  view source on GitHub ↗

Error renders the 500 page.

(err error, msg string)

Source from the content-addressed store, hash-verified

164
165// Error renders the 500 page.
166func (c *Context) Error(err error, msg string) {
167 log.ErrorDepth(4, "%s: %v", msg, err)
168
169 c.Title("status.internal_server_error")
170
171 // Only in non-production mode or admin can see the actual error message.
172 if !conf.IsProdMode() || (c.IsLogged && c.User.IsAdmin) {
173 c.Data["ErrorMsg"] = err
174 }
175 c.HTML(http.StatusInternalServerError, fmt.Sprintf("status/%d", http.StatusInternalServerError))
176}
177
178// Errorf renders the 500 response with formatted message.
179func (c *Context) Errorf(err error, format string, args ...any) {

Callers 3

ErrorfMethod · 0.95
NotFoundOrErrorMethod · 0.95
ContexterFunction · 0.95

Calls 3

TitleMethod · 0.95
HTMLMethod · 0.95
IsProdModeFunction · 0.92

Tested by

no test coverage detected