MCPcopy
hub / github.com/golang-jwt/jwt / newError

Function newError

errors.go:71–89  ·  errors.go::newError

newError creates a new error message with a detailed error message. The message will be prefixed with the contents of the supplied error type. Additionally, more errors, that provide more context can be supplied which will be appended to the message. This makes use of Go 1.20's possibility to includ

(message string, err error, more ...error)

Source from the content-addressed store, hash-verified

69//
70// "token is unverifiable: no keyfunc was provided"
71func newError(message string, err error, more ...error) error {
72 var format string
73 var args []any
74 if message != "" {
75 format = "%w: %s"
76 args = []any{err, message}
77 } else {
78 format = "%w"
79 args = []any{err}
80 }
81
82 for _, e := range more {
83 format += ": %w"
84 args = append(args, e)
85 }
86
87 err = fmt.Errorf(format, args...)
88 return err
89}

Callers 15

VerifyMethod · 0.85
SignMethod · 0.85
VerifyMethod · 0.85
SignMethod · 0.85
Test_newErrorFunction · 0.85
ParseWithClaimsMethod · 0.85
ParseUnverifiedMethod · 0.85
parseNumericDateMethod · 0.85
parseClaimsStringMethod · 0.85
parseStringMethod · 0.85
VerifyMethod · 0.85
SignMethod · 0.85

Calls

no outgoing calls

Tested by 1

Test_newErrorFunction · 0.68