|
NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
异常处理类与工具 更多...
专题 | |
| 异常类集 | |
| 全部异常类的集合 | |
类 | |
| class | exception_wrapper |
| 异常包装器基类 更多... | |
| class | typed_exception_wrapper< Ex > |
| 类型化异常包装器模板类 更多... | |
| class | exception_ptr |
| 异常指针类 更多... | |
宏定义 | |
| #define | NEFORCE_ERROR_BUILD_DERIVED_CLASS(THIS, BASE, INFO) |
| 构建可派生的异常类宏 | |
| #define | NEFORCE_ERROR_BUILD_FINAL_CLASS(THIS, BASE, INFO) |
| 构建最终异常类宏 | |
函数 | |
| int NEFORCE_API | uncaught_exceptions () noexcept NEFORCE_PURE_FUNCTION |
| 未捕获的异常数量 | |
| void NEFORCE_API | throw_with_stack (const exception &err) |
| 抛出异常并打印堆栈信息 | |
| template<typename Ex> | |
| exception_ptr | make_exception_ptr (Ex ex) |
| 创建异常指针 | |
| exception_ptr NEFORCE_API | current_exception () |
| 获取当前异常 | |
| void NEFORCE_API | rethrow_exception (const exception_ptr &p) |
| 重新抛出异常 | |
异常处理类与工具
| #define NEFORCE_ERROR_BUILD_DERIVED_CLASS | ( | THIS, | |
| BASE, | |||
| INFO ) |
构建可派生的异常类宏
| THIS | 当前类名 |
| BASE | 基类名 |
| INFO | 默认错误信息 |
快速定义可进一步派生的异常类。
在文件 exception.hpp 第 43 行定义.
| #define NEFORCE_ERROR_BUILD_FINAL_CLASS | ( | THIS, | |
| BASE, | |||
| INFO ) |
构建最终异常类宏
| THIS | 当前类名 |
| BASE | 基类名 |
| INFO | 默认错误信息 |
快速定义不可派生的异常类。
在文件 exception.hpp 第 59 行定义.
|
noexcept |
获取当前异常
捕获当前异常并创建异常指针。 如果当前没有异常被捕获,返回空的异常指针。
被这些函数引用 retry(), generator< T >::promise_type::unhandled_exception(), task< T >::promise_type::unhandled_exception() , 以及 virtual_thread_task::promise_type::unhandled_exception().
|
noexcept |
创建异常指针
| Ex | 异常类型 |
| ex | 异常对象 |
创建引用指定异常的异常指针。 如果内存分配失败,返回空的异常指针。
在文件 exception_ptr.hpp 第 314 行定义.
| void NEFORCE_API rethrow_exception | ( | const exception_ptr & | p | ) |
重新抛出异常
| p | 异常指针 |
重新抛出异常指针引用的异常。
引用了 rethrow_exception().
被这些函数引用 task< T >::awaiter::await_resume(), generator< T >::begin(), task< T >::get(), rethrow_exception() , 以及 retry().
| void NEFORCE_API throw_with_stack | ( | const exception & | err | ) |
|
noexcept |
未捕获的异常数量
该函数返回在当前线程中已经抛出但尚未被捕获的异常数量。
被这些函数引用 scope_fail< Func >::scope_fail(), scope_success< Func >::scope_success(), uncaught_exceptions(), scope_fail< Func >::~scope_fail() , 以及 scope_success< Func >::~scope_success().