errors

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnexpectedError           = errors.New("unexpected error")
	ErrSystemError               = errors.New("system error")
	ErrUnauthorized              = errors.New("request not authenticated or key/signature is incorrect")
	ErrIllegalIP                 = errors.New("ip address not whitelisted")
	ErrBadRequest                = errors.New("missing required fields")
	ErrUserTierInvalid           = errors.New("disallowed based on user tier")
	ErrTooManyRequests           = errors.New("requests have exceeded rate limits")
	ErrInvalidNonce              = errors.New("nonce value differs by more than 30 seconds from server")
	ErrMethodNotFound            = errors.New("invalid method specified")
	ErrInvalidDateRange          = errors.New("invalid date range")
	ErrDuplicateRecord           = errors.New("duplicated record")
	ErrNegativeBalance           = errors.New("insufficient balance")
	ErrSymbolNotFound            = errors.New("invalid instrument_name specified")
	ErrSideNotSupported          = errors.New("invalid side specified")
	ErrOrderTypeNotSupported     = errors.New("invalid type specified")
	ErrMinPriceViolated          = errors.New("price is lower than the minimum")
	ErrMaxPriceViolated          = errors.New("price is higher than the maximum")
	ErrMinQuantityViolated       = errors.New("quantity is lower than the minimum")
	ErrMaxQuantityViolated       = errors.New("quantity is higher than the maximum")
	ErrMissingArgument           = errors.New("required argument is blank or missing")
	ErrInvalidPricePrecision     = errors.New("too many decimal places for price")
	ErrInvalidQuantityPrecision  = errors.New("too many decimal places for quantity")
	ErrMinNotionalViolated       = errors.New("the notional amount is less than the minimum")
	ErrMaxNotionalViolated       = errors.New("the notional amount exceeds the maximum")
	ErrMinAmountViolated         = errors.New("amount is less than the minimum")
	ErrMaxAmountViolated         = errors.New("amount exceeds the maximum")
	ErrAmountPrecisionOverflow   = errors.New("amount precision exceeds the maximum")
	ErrMGInvalidAccountStatus    = errors.New("operation has failed due to your account's status. please try again later")
	ErrMGTransferActiveLoan      = errors.New("transfer has failed due to holding an active loan. please repay your loan and try again later")
	ErrMGInvalidLoanCurrency     = errors.New("currency is not same as loan currency of active loan")
	ErrMGInvalidRepayAmount      = errors.New("only supporting full repayment of all margin loans")
	ErrMGNoActiveLoan            = errors.New("no active loan")
	ErrMGBlockedBorrow           = errors.New("borrow has been suspended. please try again later")
	ErrMGBlockedNewOrder         = errors.New("placing new order has been suspended. please try again later")
	ErrMGCreditLineNotMaintained = errors.New("please ensure your credit line is maintained and try again later")
)

Functions

func NewResponseError

func NewResponseError(httpStatusCode int, code int64) error

NewResponseError creates a new instance of ResponseError based on the status code and response code

Types

type InvalidParameterError

type InvalidParameterError struct {
	Parameter string
	Reason    string
}

InvalidParameterError is returned when a required parameter is passed that is invalid.

func (InvalidParameterError) Error

func (ipe InvalidParameterError) Error() string

type ResponseError

type ResponseError struct {
	Code           int64
	HTTPStatusCode int
	Err            error
}

ResponseError is returned when an error is returned from the API.

func (ResponseError) Error

func (re ResponseError) Error() string

Error will return a string representation of the response error in the following format: 401 Unauthorized: (10003) ip address not whitelisted

func (ResponseError) Unwrap

func (re ResponseError) Unwrap() error

Jump to

Keyboard shortcuts

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