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

Function fail

internal/cmd/serv.go:37–49  ·  view source on GitHub ↗

fail prints user message to the Git client (i.e. os.Stderr) and logs error message on the server side. When not in "prod" mode, error message is also printed to the client for easier debugging.

(userMessage, errMessage string, args ...any)

Source from the content-addressed store, hash-verified

35// logs error message on the server side. When not in "prod" mode,
36// error message is also printed to the client for easier debugging.
37func fail(userMessage, errMessage string, args ...any) {
38 _, _ = fmt.Fprintln(os.Stderr, "Gogs:", userMessage)
39
40 if len(errMessage) > 0 {
41 if !conf.IsProdMode() {
42 fmt.Fprintf(os.Stderr, errMessage+"\n", args...)
43 }
44 log.Error(errMessage, args...)
45 }
46
47 log.Stop()
48 os.Exit(1)
49}
50
51func setup(c *cli.Context, logFile string, connectDB bool) {
52 conf.HookMode = true

Callers 6

setupFunction · 0.70
checkDeployKeyFunction · 0.70
runServFunction · 0.70
runHookPreReceiveFunction · 0.70
runHookUpdateFunction · 0.70
runHookPostReceiveFunction · 0.70

Calls 3

IsProdModeFunction · 0.92
StopMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected