Documentation ¶
Index ¶
- Constants
- Variables
- func Errorc(code Code, msg string) error
- func Errorcf(code Code, f string, args ...interface{}) error
- func Errorf(f string, args ...interface{}) error
- func FindCause(err error, cb func(err error) bool) error
- func Is(err, target error) bool
- func IsCritical(e error) bool
- func IsCriticalCode(c Code) bool
- func New(msg string) error
- func NewBase(code Code, msg string) *baseError
- func ToString(e error) string
- func Unwrap(err error) error
- func WithCode(err error, code Code) error
- func WithStack(e error) error
- func Wrap(e error, msg string) error
- func Wrapc(e error, c Code, msg string) error
- func Wrapcf(e error, c Code, f string, args ...interface{}) error
- func Wrapf(e error, f string, args ...interface{}) error
- type Code
- type ErrorCoder
- type Unwrapper
Constants ¶
View Source
const ( CriticalUnknownError = CodeCritical + iota CriticalIOError CriticalFormatError CriticalHashError CriticalRerunError )
View Source
const CodeSegment = 1000
Variables ¶
View Source
var ( ErrUnknown = NewBase(UnknownError, "UnknownError") ErrIllegalArgument = NewBase(IllegalArgumentError, "IllegalArgument") ErrInvalidState = NewBase(InvalidStateError, "InvalidState") ErrUnsupported = NewBase(UnsupportedError, "Unsupported") ErrNotFound = NewBase(NotFoundError, "NotFound") ErrInvalidNetwork = NewBase(InvalidNetworkError, "InvalidNetwork") ErrTimeout = NewBase(TimeoutError, "Timeout") ErrExecutionFail = NewBase(ExecutionFailError, "ExecutionFail") ErrInterrupted = NewBase(InterruptedError, "Interrupted") )
Functions ¶
func IsCritical ¶
func IsCriticalCode ¶
Types ¶
type Code ¶
type Code int
const ( CodeSCORE Code = iota * CodeSegment CodeGeneral CodeService CodeConsensus CodeNetwork CodeBlock CodeServer CodeCritical )
const ( Success Code = 0 UnknownError Code = CodeGeneral + iota IllegalArgumentError UnsupportedError InvalidStateError NotFoundError InvalidNetworkError TimeoutError ExecutionFailError InterruptedError )
type ErrorCoder ¶
func CoderOf ¶
func CoderOf(e error) (ErrorCoder, bool)
Click to show internal directories.
Click to hide internal directories.