7#if !defined(ASYNC_MQTT_EXCEPTION_HPP)
8#define ASYNC_MQTT_EXCEPTION_HPP
13#include <boost/system/error_code.hpp>
14#include <boost/system/system_error.hpp>
15#include <boost/assert.hpp>
16#include <boost/operators.hpp>
18#include <async_mqtt/util/string_view.hpp>
22namespace sys = boost::system;
23using error_code = sys::error_code;
24namespace errc = sys::errc;
29struct system_error : sys::system_error,
private boost::totally_ordered<system_error> {
30 using base_type = sys::system_error;
31 using base_type::base_type;
51 return code().message();
59 return code() != errc::success;
72template <
typename WhatArg>
79 std::tuple<error_code, string_view>(
lhs.code(),
lhs.what()) ==
80 std::tuple<error_code, string_view>(
rhs.code(),
rhs.what());
83inline bool operator<(system_error
const& lhs, system_error
const& rhs) {
85 std::tuple<error_code, string_view>(lhs.code(), lhs.what()) <
86 std::tuple<error_code, string_view>(rhs.code(), rhs.what());
89inline std::ostream& operator<<(std::ostream& o, system_error
const& v) {
Definition packet_variant.hpp:49
async_mqtt error class. It is used as CompletionToken parameter and exception.
Definition exception.hpp:29
system_error(error_code const &ec=error_code())
constructor
Definition exception.hpp:37
std::string message() const
get error message If you want to more detaied error message, call what() instead.
Definition exception.hpp:50
system_error make_error(errc::errc_t ec, WhatArg &&wa)
system_error factory function
Definition exception.hpp:73