MCPcopy
hub / github.com/pkg/errors / New

Function New

errors.go:102–107  ·  view source on GitHub ↗

New returns an error with the supplied message. New also records the stack trace at the point it was called.

(message string)

Source from the content-addressed store, hash-verified

100// New returns an error with the supplied message.
101// New also records the stack trace at the point it was called.
102func New(message string) error {
103 return &fundamental{
104 msg: message,
105 stack: callers(),
106 }
107}
108
109// Errorf formats according to a format specifier and returns the string
110// as a value that satisfies error.

Callers 14

TestFormatNewFunction · 0.85
TestFormatWrapFunction · 0.85
TestFormatWrapfFunction · 0.85
TestFormatWithStackFunction · 0.85
TestFormatWithMessageFunction · 0.85
TestFormatGenericFunction · 0.85
wrappedNewFunction · 0.85
TestNewFunction · 0.85
TestCauseFunction · 0.85
TestErrorEqualityFunction · 0.85
TestStackTraceFunction · 0.85
yesErrorsFunction · 0.85

Calls 1

callersFunction · 0.85

Tested by 14

TestFormatNewFunction · 0.68
TestFormatWrapFunction · 0.68
TestFormatWrapfFunction · 0.68
TestFormatWithStackFunction · 0.68
TestFormatWithMessageFunction · 0.68
TestFormatGenericFunction · 0.68
wrappedNewFunction · 0.68
TestNewFunction · 0.68
TestCauseFunction · 0.68
TestErrorEqualityFunction · 0.68
TestStackTraceFunction · 0.68
yesErrorsFunction · 0.68