MCPcopy Create free account
hub / github.com/kataras/iris / newError

Function newError

_examples/database/mongodb/httputil/error.go:59–77  ·  view source on GitHub ↗
(statusCode int, err error, format string, args ...interface{})

Source from the content-addressed store, hash-verified

57}
58
59func newError(statusCode int, err error, format string, args ...interface{}) HTTPError {
60 if format == "" {
61 format = http.StatusText(statusCode)
62 }
63
64 desc := fmt.Sprintf(format, args...)
65 if err == nil {
66 err = errors.New(desc)
67 }
68
69 return HTTPError{
70 err,
71 string(debug.Stack()),
72 RuntimeCallerStack(),
73 time.Now(),
74 statusCode,
75 desc,
76 }
77}
78
79func (err HTTPError) writeHeaders(ctx iris.Context) {
80 ctx.StatusCode(err.StatusCode)

Callers 2

FailFunction · 0.70
FailJSONFunction · 0.70

Calls 3

RuntimeCallerStackFunction · 0.85
NewMethod · 0.80
NowMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…