// New returns an error with the supplied message.
codevtrpcpb.Code
// New also records the stack trace at the point it was called.
errstring
funcNew(codevtrpcpb.Code,messagestring)error{
}
return&fundamental{
msg:message,
// New creates a new error using the code and input string.
funcNew(codevtrpcpb.Code,instring)error{
ifcode==vtrpcpb.Code_OK{
panic("OK is an invalid error code; use INTERNAL instead")
}
return&vtError{
code:code,
code:code,
err:in,
stack:callers(),
}
}
}
}
// Wrap wraps the given error, returning a new error with the given message as a prefix but with the same error code (if err was a vterror) and message of the passed error.
// NewWithoutCode returns an error when no applicable error code is available
funcWrap(errerror,messagestring)error{
// It will record the stack trace when creating the error
// Wrapf wraps the given error, returning a new error with the given format string as a prefix but with the same error code (if err was a vterror) and message of the passed error.
// Errorf formats according to a format specifier and returns the string