Binance C++ Connector 2.0.0
Official C++ connectors for the Binance APIs
Loading...
Searching...
No Matches
binance::common::WebsocketResponseError Class Reference

The server answered with an error (status >= 400), e.g. {"code":-1021,"msg":"..."}. More...

#include <errors.hpp>

Inheritance diagram for binance::common::WebsocketResponseError:
binance::common::WebsocketError binance::common::Error

Public Member Functions

 WebsocketResponseError (std::int64_t code, const std::string &msg, std::uint16_t status=0)
 WebsocketResponseError (std::int64_t code, const std::string &msg, std::uint16_t status, std::vector< WebsocketApiRateLimit > rate_limits, std::optional< std::chrono::system_clock::time_point > retry_at={}, std::shared_ptr< const boost::json::value > data=nullptr)
std::uint16_t status () const noexcept
 The response's status (e.g. 400, 403, 429, 418), or 0.
const std::vector< WebsocketApiRateLimit > & rate_limits () const noexcept
 The response's rateLimits, if any.
std::optional< std::chrono::system_clock::time_point > retry_at () const noexcept
 When to retry, from error.data.retryAfter (418 / 429).
const boost::json::value * data () const noexcept
 The response's error.data, as Binance sent it, or nullptr when it has none.
Public Member Functions inherited from binance::common::WebsocketError
 WebsocketError (const std::string &what, bool request_sent=false)
 WebsocketError (const std::string &what, std::string msg, std::optional< std::int64_t > code, bool request_sent)
bool request_sent () const noexcept
 True when the request was handed to the connection, so Binance may have executed it and the outcome is unknown.
Public Member Functions inherited from binance::common::Error
 Error (const std::string &what, std::string msg, std::optional< std::int64_t > code=std::nullopt)
const std::string & msg () const noexcept
std::optional< std::int64_t > code () const noexcept

Detailed Description

The server answered with an error (status >= 400), e.g. {"code":-1021,"msg":"..."}.

Constructor & Destructor Documentation

◆ WebsocketResponseError() [1/2]

binance::common::WebsocketResponseError::WebsocketResponseError ( std::int64_t code,
const std::string & msg,
std::uint16_t status = 0 )

◆ WebsocketResponseError() [2/2]

binance::common::WebsocketResponseError::WebsocketResponseError ( std::int64_t code,
const std::string & msg,
std::uint16_t status,
std::vector< WebsocketApiRateLimit > rate_limits,
std::optional< std::chrono::system_clock::time_point > retry_at = {},
std::shared_ptr< const boost::json::value > data = nullptr )

Member Function Documentation

◆ status()

std::uint16_t binance::common::WebsocketResponseError::status ( ) const
inlinenodiscardnoexcept

The response's status (e.g. 400, 403, 429, 418), or 0.

◆ rate_limits()

const std::vector< WebsocketApiRateLimit > & binance::common::WebsocketResponseError::rate_limits ( ) const
inlinenodiscardnoexcept

The response's rateLimits, if any.

◆ retry_at()

std::optional< std::chrono::system_clock::time_point > binance::common::WebsocketResponseError::retry_at ( ) const
inlinenodiscardnoexcept

When to retry, from error.data.retryAfter (418 / 429).

Binance sends this as an epoch timestamp in milliseconds, so it is a point in time, not a delay.

◆ data()

const boost::json::value * binance::common::WebsocketResponseError::data ( ) const
inlinenodiscardnoexcept

The response's error.data, as Binance sent it, or nullptr when it has none.