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

Function newError

_examples/database/mysql/api/httperror.go:19–39  ·  view source on GitHub ↗
(statusCode int, method, path, format string, args ...interface{})

Source from the content-addressed store, hash-verified

17}
18
19func newError(statusCode int, method, path, format string, args ...interface{}) Error {
20 msg := format
21 if len(args) > 0 {
22 // why we check for that? If the original error message came from our database
23 // and it contains fmt-reserved words
24 // like %s or %d we will get MISSING(=...) in our error message and we don't want that.
25 msg = fmt.Sprintf(msg, args...)
26 }
27
28 if msg == "" {
29 msg = iris.StatusText(statusCode)
30 }
31
32 return Error{
33 StatusCode: statusCode,
34 Method: method,
35 Path: path,
36 Message: msg,
37 Timestamp: time.Now().Unix(),
38 }
39}
40
41// Error implements the internal Go error interface.
42func (e Error) Error() string {

Callers 9

writeInternalServerErrorFunction · 0.70
writeEntityNotFoundFunction · 0.70
CreateMethod · 0.70
UpdateMethod · 0.70
PartialUpdateMethod · 0.70
CreateMethod · 0.70
UpdateMethod · 0.70
PartialUpdateMethod · 0.70
InsertProductsMethod · 0.70

Calls 1

NowMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…