File indexing completed on 2026-05-03 08:13:43
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _LIBCPP___CXX03___SYSTEM_ERROR_SYSTEM_ERROR_H
0011 #define _LIBCPP___CXX03___SYSTEM_ERROR_SYSTEM_ERROR_H
0012
0013 #include <__cxx03/__config>
0014 #include <__cxx03/__system_error/error_category.h>
0015 #include <__cxx03/__system_error/error_code.h>
0016 #include <__cxx03/__verbose_abort>
0017 #include <__cxx03/stdexcept>
0018 #include <__cxx03/string>
0019
0020 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0021 # pragma GCC system_header
0022 #endif
0023
0024 _LIBCPP_BEGIN_NAMESPACE_STD
0025
0026 class _LIBCPP_EXPORTED_FROM_ABI system_error : public runtime_error {
0027 error_code __ec_;
0028
0029 public:
0030 system_error(error_code __ec, const string& __what_arg);
0031 system_error(error_code __ec, const char* __what_arg);
0032 system_error(error_code __ec);
0033 system_error(int __ev, const error_category& __ecat, const string& __what_arg);
0034 system_error(int __ev, const error_category& __ecat, const char* __what_arg);
0035 system_error(int __ev, const error_category& __ecat);
0036 _LIBCPP_HIDE_FROM_ABI system_error(const system_error&) _NOEXCEPT = default;
0037 ~system_error() _NOEXCEPT override;
0038
0039 _LIBCPP_HIDE_FROM_ABI const error_code& code() const _NOEXCEPT { return __ec_; }
0040 };
0041
0042 _LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_system_error(int __ev, const char* __what_arg);
0043 _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __throw_system_error(error_code __ec, const char* __what_arg) {
0044 #ifndef _LIBCPP_HAS_NO_EXCEPTIONS
0045 throw system_error(__ec, __what_arg);
0046 #else
0047 _LIBCPP_VERBOSE_ABORT(
0048 "system_error was thrown in -fno-exceptions mode with error %i and message \"%s\"", __ec.value(), __what_arg);
0049 #endif
0050 }
0051
0052 _LIBCPP_END_NAMESPACE_STD
0053
0054 #endif