MCPcopy
hub / github.com/duke-git/lancet / New

Function New

xerror/xerror.go:26–30  ·  view source on GitHub ↗

New creates a new XError with message

(format string, args ...any)

Source from the content-addressed store, hash-verified

24
25// New creates a new XError with message
26func New(format string, args ...any) *XError {
27 err := newXError()
28 err.message = fmt.Sprintf(format, args...)
29 return err
30}
31
32// Wrap creates a new XError and add message.
33func Wrap(cause error, message ...any) *XError {

Callers 15

ExampleNewFunction · 0.70
ExampleWrapFunction · 0.70
ExampleXError_WrapFunction · 0.70
ExampleXError_UnwrapFunction · 0.70
ExampleXError_StackTraceFunction · 0.70
ExampleXError_WithFunction · 0.70
ExampleXError_IdFunction · 0.70
ExampleXError_IsFunction · 0.70
ExampleXError_ValuesFunction · 0.70
TestNewFunction · 0.70
TestWrapFunction · 0.70
TestXError_WrapFunction · 0.70

Calls 1

newXErrorFunction · 0.85

Tested by 15

ExampleNewFunction · 0.56
ExampleWrapFunction · 0.56
ExampleXError_WrapFunction · 0.56
ExampleXError_UnwrapFunction · 0.56
ExampleXError_StackTraceFunction · 0.56
ExampleXError_WithFunction · 0.56
ExampleXError_IdFunction · 0.56
ExampleXError_IsFunction · 0.56
ExampleXError_ValuesFunction · 0.56
TestNewFunction · 0.56
TestWrapFunction · 0.56
TestXError_WrapFunction · 0.56