errors

package
v0.0.0-...-7e7b345 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package errors defines the errors used in multiple packages in common.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cause

func Cause(err error) error

Cause Cause returns the underlying cause of the error, if possible. An error value has a cause if it implements the following interface:

This function just wraps the Cause in pkg/errors library.

func Errorf

func Errorf(format string, args ...interface{}) error

Errorf formats according to a format specifier and returns the string as a value that satisfies error. Errorf also records the stack trace at the point it was called.

This function just wraps the Errorf in pkg/errors library.

func New

func New(text string) error

New returns an error that formats as the given text.

This function just wraps the New in pkg/errors library.

func WithMessage

func WithMessage(err error, message string) error

WithMessage annotates err with a new message. If err is nil, WithMessage returns nil.

This function just wraps the WithMessage in pkg/errors library.

func WithStack

func WithStack(err error) error

WithStack annotates err with a stack trace at the point WithStack was called. If err is nil, WithStack returns nil.

This function just wraps the WithStack in pkg/errors library.

func Wrap

func Wrap(err error, message string) error

Wrap returns an error annotating err with a stack trace at the point Wrap is called, and the supplied message. If err is nil, Wrap returns nil.

This function just wraps the Wrap in pkg/errors library.

func Wrapf

func Wrapf(err error, format string, args ...interface{}) error

Wrapf returns an error annotating err with a stack trace at the point Wrapf is called, and the format specifier. If err is nil, Wrapf returns nil.

This function just wraps the Wrapf in pkg/errors library.

Types

type ErrInvalidLength

type ErrInvalidLength struct {
	Type    interface{}
	Message string
}

ErrInvalidLength indicates the value in Length field is invalid.

func NewErrInvalidLength

func NewErrInvalidLength(rcvType interface{}, msg string) *ErrInvalidLength

NewErrInvalidLength creates a ErrInvalidLength.

func (*ErrInvalidLength) Error

func (e *ErrInvalidLength) Error() string

Error returns the type of receiver and some additional message.

type ErrInvalidType

type ErrInvalidType struct {
	Type    interface{}
	Action  string
	Message string
}

ErrInvalidType indicates the value in Type/Code field is invalid.

func NewErrInvalidType

func NewErrInvalidType(invalidType interface{}, action, msg string) *ErrInvalidType

NewErrInvalidType creates a ErrInvalidType.

The parameter action is the action taken when this error is raised(e.g., "decode").

func (*ErrInvalidType) Error

func (e *ErrInvalidType) Error() string

Error returns the type of receiver and some additional message.

type ErrReceiverNil

type ErrReceiverNil struct {
	Type interface{}
}

ErrReceiverNil indicates the receiver is nil.

func NewErrReceiverNil

func NewErrReceiverNil(rcvType interface{}) *ErrReceiverNil

NewErrReceiverNil creates a ErrReceiverNil.

func (*ErrReceiverNil) Error

func (e *ErrReceiverNil) Error() string

Error returns the type of receiver.

type ErrTooShortToDecode

type ErrTooShortToDecode struct {
	Type    interface{}
	Message string
}

ErrTooShortToDecode indicates the length of user input is too short to be decoded.

func NewErrTooShortToDecode

func NewErrTooShortToDecode(decodedType interface{}, msg string) *ErrTooShortToDecode

NewErrTooShortToDecode creates a ErrTooShortToDecode.

func (*ErrTooShortToDecode) Error

func (e *ErrTooShortToDecode) Error() string

Error returns the type of receiver of decoder method and some additional message.

type ErrUnsupported

type ErrUnsupported struct {
	Type    interface{}
	Message string
}

ErrUnsupported indicates the value in Version field is invalid.

func NewErrUnsupported

func NewErrUnsupported(unsupportedType interface{}, msg string) *ErrUnsupported

NewErrUnsupported creates a ErrUnsupported.

func (*ErrUnsupported) Error

func (e *ErrUnsupported) Error() string

Error returns the type of receiver and some additional message.

type Frame

type Frame = errors.Frame

Frame represents a program counter inside a stack frame.

This type is just an alias of Frame in pkg/errors library.

type StackTrace

type StackTrace = errors.StackTrace

StackTrace is stack of Frames from innermost (newest) to outermost (oldest).

This type is just an alias of Frame in pkg/errors library.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL