MCPcopy Create free account
hub / github.com/DoNewsCode/core / New

Function New

unierr/error.go:30–38  ·  view source on GitHub ↗

New returns an error representing code and msg. If code is OK, returns nil.

(code codes.Code, msg string)

Source from the content-addressed store, hash-verified

28
29// New returns an error representing code and msg. If code is OK, returns nil.
30func New(code codes.Code, msg string) *Error {
31 if code == codes.OK {
32 return nil
33 }
34 return &Error{
35 msg: msg,
36 code: code,
37 }
38}
39
40// Newf returns New(code, fmt.Sprintf(format, args...)).
41func Newf(code codes.Code, format string, args ...interface{}) *Error {

Callers 2

NewfFunction · 0.70

Calls

no outgoing calls

Tested by 1