errs

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeNetFail = -1*iota - 1
	CodeNotSupport
	CodeInvalidRequest
	CodeAccKeyError
	CodeMissingApiKey
	CodeCredsRequired
	CodeSignFail
	CodeRunTime
	CodeNotImplement
	CodeMarketNotLoad
	CodeNoMarketForPair
	CodeUnsupportMarket
	CodeSandboxApiNotSupport
	CodeApiNotSupport
	CodeInvalidResponse
	CodeUnmarshalFail
	CodeParamRequired
	CodeParamInvalid
	CodeWsInvalidMsg
	CodeWsReadFail
	CodeConnectFail
	CodeInvalidTimeFrame
	CodePrecDecFail
	CodeBadExgName
)

Variables

View Source
var (
	MissingApiKey        = NewMsg(CodeMissingApiKey, "ApiKey missing")
	CredsRequired        = NewMsg(CodeCredsRequired, "credential fields missing")
	ApiNotSupport        = NewMsg(CodeApiNotSupport, "api not support")
	SandboxApiNotSupport = NewMsg(CodeSandboxApiNotSupport, "sandbox api not support")
	UnsupportMarket      = NewMsg(CodeUnsupportMarket, "unsupported market type")
	NoMarketForPair      = NewMsg(CodeNoMarketForPair, "no market found for pair")
	MarketNotLoad        = NewMsg(CodeMarketNotLoad, "markets not loaded")
	NotImplement         = NewMsg(CodeNotImplement, "method not implement")
	InvalidTimeFrame     = NewMsg(CodeInvalidTimeFrame, "invalid timeframe")
)
View Source
var (
	PrintErr func(e error) string // print string for common error
)

Functions

func CallStack added in v0.1.3

func CallStack(skip, maxNum int) string

Types

type Error

type Error struct {
	Code int

	Stack string

	Data interface{}
	// contains filtered or unexported fields
}

func New

func New(code int, err error) *Error

func NewFull added in v0.2.0

func NewFull(code int, err error, format string, a ...any) *Error

func NewMsg

func NewMsg(code int, format string, a ...any) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Message added in v0.2.0

func (e *Error) Message() string

func (*Error) Short added in v0.2.0

func (e *Error) Short() string

func (*Error) Unwrap added in v0.2.0

func (e *Error) Unwrap() error

Jump to

Keyboard shortcuts

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