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

The request never produced an HTTP response (DNS, connect, TLS, timeout, reset, …). More...

#include <errors.hpp>

Inheritance diagram for binance::common::NetworkError:
binance::common::ConnectorError binance::common::Error binance::common::RequestCancelledError binance::common::RequestTimeoutError

Public Member Functions

 NetworkError (const std::string &msg, bool request_sent=false, boost::system::error_code transport_error={})
bool request_sent () const noexcept
 True when the full request was written on at least one attempt, so Binance may have executed it.
boost::system::error_code transport_error () const noexcept
 The transport-level cause (e.g.
Public Member Functions inherited from binance::common::ConnectorError
 ConnectorError (const std::string &what, std::string msg, std::optional< std::int64_t > code=std::nullopt)
const RawResponse * response () const noexcept
 The HTTP response that caused the error, when there was one: status, headers (e.g.
std::optional< std::chrono::seconds > retry_after () const noexcept
 The delay from the Retry-After header of a 418 / 429 response, if it has one.
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 request never produced an HTTP response (DNS, connect, TLS, timeout, reset, …).

Constructor & Destructor Documentation

◆ NetworkError()

binance::common::NetworkError::NetworkError ( const std::string & msg,
bool request_sent = false,
boost::system::error_code transport_error = {} )
explicit

Member Function Documentation

◆ request_sent()

bool binance::common::NetworkError::request_sent ( ) const
inlinenodiscardnoexcept

True when the full request was written on at least one attempt, so Binance may have executed it.

The outcome is then unknown. For orders, look the order up (e.g. by newClientOrderId) before sending it again.

◆ transport_error()

boost::system::error_code binance::common::NetworkError::transport_error ( ) const
inlinenodiscardnoexcept

The transport-level cause (e.g.

boost::asio::error::connection_refused, boost::asio::error::host_not_found, boost::beast::error::timeout, an SSL error), or an empty error code when there is none, e.g. for a rejected proxy CONNECT.