errors

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 9 Imported by: 12

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 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

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 BadRequest Status = 400

BadRequest means the request was invalid.

const BadSignerVersion Status = 411

BadSignerVersion means the signer version does not match.

const BadTimestamp Status = 412

BadTimestamp means the timestamp is invalid.

const BadUrlLength Status = 413

BadUrlLength means the url length is too big.

const Conflict Status = 409

Conflict means the request failed due to a conflict.

const Delivered Status = 201

Delivered means the transaction has been delivered.

const EncodingError Status = 502

EncodingError means encoding or decoding failed.

const FatalError Status = 503

FatalError means something has gone seriously wrong.

const IncompleteChain Status = 414

IncompleteChain means the chain does not include the full history.

const InsufficientBalance Status = 415

InsufficientBalance means the account balance is insufficient to satisfy the request.

const InsufficientCredits Status = 402

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

const InternalError Status = 500

InternalError means an internal error occured.

const NotAllowed Status = 405

NotAllowed means the requested action could not be performed.

const NotFound Status = 404

NotFound means a record could not be found.

const OK Status = 200

OK means the request completed successfully.

const Pending Status = 202

Pending means the transaction is pending.

const Remote Status = 203

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

const Unauthenticated Status = 401

Unauthenticated means the signature could not be validated.

const Unauthorized Status = 403

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

const UnknownError Status = 501

UnknownError means an unknown error occured.

const WrongPartition Status = 301

WrongPartition 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