MCPcopy Create free account
hub / github.com/cortexproject/cortex / CheckFatal

Function CheckFatal

pkg/util/log/log.go:108–118  ·  view source on GitHub ↗

CheckFatal prints an error and exits with error code 1 if err is non-nil

(location string, err error)

Source from the content-addressed store, hash-verified

106
107// CheckFatal prints an error and exits with error code 1 if err is non-nil
108func CheckFatal(location string, err error) {
109 if err != nil {
110 logger := level.Error(Logger)
111 if location != "" {
112 logger = log.With(logger, "msg", "error "+location)
113 }
114 // %+v gets the stack trace from errors using github.com/pkg/errors
115 logger.Log("err", fmt.Sprintf("%+v", err))
116 os.Exit(1)
117 }
118}

Callers 1

mainFunction · 0.92

Calls 2

ErrorMethod · 0.45
LogMethod · 0.45

Tested by

no test coverage detected