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

HTTP 5xx. More...

#include <errors.hpp>

Inheritance diagram for binance::common::ServerError:
binance::common::ConnectorError binance::common::Error

Public Member Functions

 ServerError (const std::string &msg, std::optional< std::uint16_t > status_code=std::nullopt, std::optional< std::int64_t > code=std::nullopt)
std::optional< std::uint16_t > status_code () const noexcept
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

HTTP 5xx.

msg() and code() carry Binance's error when the body has one. For example, 503 with code -1007 means the request reached the matching engine but its outcome is unknown, so query the order before resending. Otherwise msg() is "Server error: <status>".

Constructor & Destructor Documentation

◆ ServerError()

binance::common::ServerError::ServerError ( const std::string & msg,
std::optional< std::uint16_t > status_code = std::nullopt,
std::optional< std::int64_t > code = std::nullopt )
explicit

Member Function Documentation

◆ status_code()

std::optional< std::uint16_t > binance::common::ServerError::status_code ( ) const
inlinenodiscardnoexcept