11 #ifndef ASIO_SYSTEM_ERROR_HPP 12 #define ASIO_SYSTEM_ERROR_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 18 #include "asio/detail/config.hpp" 20 #if defined(ASIO_HAS_STD_SYSTEM_ERROR) 21 # include <system_error> 22 #else // defined(ASIO_HAS_STD_SYSTEM_ERROR) 26 # include "asio/error_code.hpp" 27 # include "asio/detail/scoped_ptr.hpp" 28 #endif // defined(ASIO_HAS_STD_SYSTEM_ERROR) 30 #include "asio/detail/push_options.hpp" 34 #if defined(ASIO_HAS_STD_SYSTEM_ERROR) 38 #else // defined(ASIO_HAS_STD_SYSTEM_ERROR) 43 :
public std::exception
62 :
std::exception(other),
64 context_(other.context_),
77 context_ = e.context_;
84 virtual const char*
what()
const throw ()
86 #if !defined(ASIO_NO_EXCEPTIONS) 88 #endif // !defined(ASIO_NO_EXCEPTIONS) 92 std::string tmp(context_);
96 what_.reset(
new std::string(tmp));
98 return what_->c_str();
100 #if !defined(ASIO_NO_EXCEPTIONS) 101 catch (std::exception&)
103 return "system_error";
105 #endif // !defined(ASIO_NO_EXCEPTIONS) 119 std::string context_;
125 #endif // defined(ASIO_HAS_STD_SYSTEM_ERROR) 129 #include "asio/detail/pop_options.hpp" 131 #endif // ASIO_SYSTEM_ERROR_HPP error_code code() const
Get the error code associated with the exception.
Definition: system_error.hpp:109
system_error(const error_code &ec, const std::string &context)
Construct with an error code and context.
Definition: system_error.hpp:54
Definition: awaitable.hpp:421
An error returned by an operating system or a language runtime, for example a file opening error...
Definition: format.h:3267
system_error(const system_error &other)
Copy constructor.
Definition: system_error.hpp:61
virtual ~system_error()
Destructor.
Definition: system_error.hpp:70
std::string message() const
Get the message associated with the error.
Definition: error_code.hpp:131
Class to represent an error code value.
Definition: error_code.hpp:80
system_error(const error_code &ec)
Construct with an error code.
Definition: system_error.hpp:47
virtual const char * what() const
Get a string representation of the exception.
Definition: system_error.hpp:84
system_error & operator=(const system_error &e)
Assignment operator.
Definition: system_error.hpp:75
Definition: any_io_executor.hpp:28