MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / system_error

Class system_error

3rd/asio-1.24.0/include/asio/system_error.hpp:42–123  ·  view source on GitHub ↗

The system_error class is used to represent system conditions that prevent the library from operating correctly.

Source from the content-addressed store, hash-verified

40/// The system_error class is used to represent system conditions that
41/// prevent the library from operating correctly.
42class system_error
43 : public std::exception
44{
45public:
46 /// Construct with an error code.
47 system_error(const error_code& ec)
48 : code_(ec),
49 context_()
50 {
51 }
52
53 /// Construct with an error code and context.
54 system_error(const error_code& ec, const std::string& context)
55 : code_(ec),
56 context_(context)
57 {
58 }
59
60 /// Copy constructor.
61 system_error(const system_error& other)
62 : std::exception(other),
63 code_(other.code_),
64 context_(other.context_),
65 what_()
66 {
67 }
68
69 /// Destructor.
70 virtual ~system_error() throw ()
71 {
72 }
73
74 /// Assignment operator.
75 system_error& operator=(const system_error& e)
76 {
77 context_ = e.context_;
78 code_ = e.code_;
79 what_.reset();
80 return *this;
81 }
82
83 /// Get a string representation of the exception.
84 virtual const char* what() const throw ()
85 {
86#if !defined(ASIO_NO_EXCEPTIONS)
87 try
88#endif // !defined(ASIO_NO_EXCEPTIONS)
89 {
90 if (!what_.get())
91 {
92 std::string tmp(context_);
93 if (tmp.length())
94 tmp += ": ";
95 tmp += code_.message();
96 what_.reset(new std::string(tmp));
97 }
98 return what_->c_str();
99 }

Callers 9

operator()Method · 0.85
operator()Method · 0.85
operator()Method · 0.85
set_errorMethod · 0.85
invalidMethod · 0.85
cancelledMethod · 0.85
interruptedMethod · 0.85
doneMethod · 0.85
resume_implMethod · 0.85

Calls 1

resetMethod · 0.45

Tested by

no test coverage detected