Documentation ¶
Overview ¶
Package errors implements errors that can be easily sent across the wire and reconstructed at the other end.
Index ¶
Constants ¶
const ( // UnknownModule is the module name used when the module is unknown. UnknownModule = "unknown" // CodeNoError is the reserved "no error" code. CodeNoError = 0 )
Variables ¶
Re-exports so this package can be used as a replacement for errors.
Functions ¶
func Code ¶
Code returns the module and code for the given error.
In case the error is not of the correct type, default values for an unknown error are returned.
In case the error is nil, an empty module name and CodeNoError are returned.
func FromCode ¶
FromCode reconstructs a previously registered error from module and code.
In case an error cannot be resolved, this method returns a new error with its message equal to the passed context string.
func New ¶
New creates a new error.
Module and code pair must be unique. If they are not, this method will panic.
The error code must not be equal to the reserved "no error" code.
func WithContext ¶ added in v0.2102.0
WithContext creates a wrapped error that provides additional context.
Types ¶
This section is empty.