errors

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

func As(err error, target interface{}) bool

As calls stdlib errors.As.

func DisableLocationTracking

func DisableLocationTracking()

func EnableLocationTracking

func EnableLocationTracking()

func Is

func Is(err, target error) bool

Is calls stdlib errors.Is.

func NotFound

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

func Unknown

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

func Unwrap

func Unwrap(err error) error

Unwrap calls stdlib errors.Unwrap.

func Wrap

func Wrap(code Status, err error) error

Types

type CallSite

type CallSite struct {
	FuncName string `json:"funcName,omitempty" form:"funcName" query:"funcName" validate:"required"`
	File     string `json:"file,omitempty" form:"file" query:"file" validate:"required"`
	Line     int64  `json:"line,omitempty" form:"line" query:"line" validate:"required"`
	// contains filtered or unexported fields
}

func (*CallSite) Copy

func (v *CallSite) Copy() *CallSite

func (*CallSite) CopyAsInterface

func (v *CallSite) CopyAsInterface() interface{}

func (*CallSite) Equal

func (v *CallSite) Equal(u *CallSite) bool

func (*CallSite) IsValid

func (v *CallSite) IsValid() error

func (*CallSite) MarshalBinary

func (v *CallSite) MarshalBinary() ([]byte, error)

func (*CallSite) UnmarshalBinary

func (v *CallSite) UnmarshalBinary(data []byte) error

func (*CallSite) UnmarshalBinaryFrom

func (v *CallSite) UnmarshalBinaryFrom(rd io.Reader) error

type Error

type Error struct {
	Message   string      `json:"message,omitempty" form:"message" query:"message" validate:"required"`
	Code      Status      `json:"code,omitempty" form:"code" query:"code" validate:"required"`
	Cause     *Error      `json:"cause,omitempty" form:"cause" query:"cause" validate:"required"`
	CallStack []*CallSite `json:"callStack,omitempty" form:"callStack" query:"callStack" validate:"required"`
	// contains filtered or unexported fields
}

func Format

func Format(code Status, format string, args ...interface{}) *Error

func FormatWithCause added in v1.0.0

func FormatWithCause(code Status, cause error, format string, args ...interface{}) *Error

func New

func New(code Status, v interface{}) *Error

func (*Error) CodeID

func (e *Error) CodeID() uint64

func (*Error) Copy

func (v *Error) Copy() *Error

func (*Error) CopyAsInterface

func (v *Error) CopyAsInterface() interface{}

func (*Error) Equal

func (v *Error) Equal(u *Error) bool

func (*Error) Error

func (e *Error) Error() string

func (*Error) Format

func (e *Error) Format(f fmt.State, verb rune)

func (*Error) Is

func (e *Error) Is(target error) bool

func (*Error) IsValid

func (v *Error) IsValid() error

func (*Error) MarshalBinary

func (v *Error) MarshalBinary() ([]byte, error)

func (*Error) MarshalJSON

func (v *Error) MarshalJSON() ([]byte, error)

func (*Error) Print

func (e *Error) Print() string

func (*Error) PrintFullCallstack

func (e *Error) PrintFullCallstack() string

func (*Error) UnmarshalBinary

func (v *Error) UnmarshalBinary(data []byte) error

func (*Error) UnmarshalBinaryFrom

func (v *Error) UnmarshalBinaryFrom(rd io.Reader) error

func (*Error) UnmarshalJSON

func (v *Error) UnmarshalJSON(data []byte) error

func (*Error) Unwrap

func (e *Error) Unwrap() error

type Status

type Status uint64

Status is a request status code.

const StatusBadRequest Status = 400

StatusBadRequest means the request was invalid.

const StatusBadSignerVersion Status = 411

StatusBadSignerVersion means the signer version does not match.

const StatusBadTimestamp Status = 412

StatusBadTimestamp means the timestamp is invalid.

const StatusConflict Status = 409

StatusConflict means the request failed due to a conflict.

const StatusDelivered Status = 201

StatusDelivered means the transaction has been delivered.

const StatusEncodingError Status = 502

StatusEncodingError means encoding or decoding failed.

const StatusFatalError Status = 503

StatusFatalError means something has gone seriously wrong.

const StatusInsufficientCredits Status = 402

StatusInsufficientCredits means the signer does not have sufficient credits to execute the transaction.

const StatusInternalError Status = 500

StatusInternalError means an internal error occured.

const StatusNotAllowed Status = 405

StatusNotAllowed means the requested action could not be performed.

const StatusNotFound Status = 404

StatusNotFound means a record could not be found.

const StatusOK Status = 200

StatusOK means the request completed successfully.

const StatusPending Status = 202

StatusPending means the transaction is pending.

const StatusRemote Status = 203

StatusRemote means the transaction is a local reference to a remote.

const StatusUnauthenticated Status = 401

StatusUnauthenticated means the signature could not be validated.

const StatusUnauthorized Status = 403

StatusUnauthorized means the signer is not authorized to sign the transaction.

const StatusUnknownError Status = 501

StatusUnknownError means an unknown error occured.

const StatusWrongPartition Status = 301

StatusWrongPartition means the requested resource is assigned to a different network partition.

func StatusByName

func StatusByName(name string) (Status, bool)

StatusByName returns the named Status.

func (Status) Error

func (s Status) Error() string

Error implements error.

func (Status) GetEnumValue

func (v Status) GetEnumValue() uint64

GetEnumValue returns the value of the Status

func (Status) MarshalJSON

func (v Status) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Status to JSON as a string.

func (*Status) SetEnumValue

func (v *Status) SetEnumValue(id uint64) bool

SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.

func (Status) String

func (v Status) String() string

String returns the name of the Status.

func (Status) Success

func (s Status) Success() bool

Success returns true if the status represents success.

func (*Status) UnmarshalJSON

func (v *Status) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the Status from JSON as a string.

Jump to

Keyboard shortcuts

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