| 3039 | } |
| 3040 | |
| 3041 | inline error error_from_exception(std::exception_ptr eptr) noexcept |
| 3042 | { |
| 3043 | if (!eptr) return make_error(dynamic_exception_errc::bad_exception); |
| 3044 | |
| 3045 | try |
| 3046 | { |
| 3047 | std::rethrow_exception(eptr); |
| 3048 | } |
| 3049 | catch (const std::domain_error&) |
| 3050 | { |
| 3051 | return make_error(dynamic_exception_errc::domain_error); |
| 3052 | } |
| 3053 | catch (const std::invalid_argument&) |
| 3054 | { |
| 3055 | return make_error(dynamic_exception_errc::invalid_argument); |
| 3056 | } |
| 3057 | catch (const std::length_error&) |
| 3058 | { |
| 3059 | return make_error(dynamic_exception_errc::length_error); |
| 3060 | } |
| 3061 | catch (const std::out_of_range&) |
| 3062 | { |
| 3063 | return make_error(dynamic_exception_errc::out_of_range); |
| 3064 | } |
| 3065 | catch (const std::logic_error&) |
| 3066 | { |
| 3067 | return make_error(dynamic_exception_errc::logic_error); |
| 3068 | } |
| 3069 | catch (const std::range_error&) |
| 3070 | { |
| 3071 | return make_error(dynamic_exception_errc::range_error); |
| 3072 | } |
| 3073 | catch (const std::overflow_error&) |
| 3074 | { |
| 3075 | return make_error(dynamic_exception_errc::overflow_error); |
| 3076 | } |
| 3077 | catch (const std::underflow_error&) |
| 3078 | { |
| 3079 | return make_error(dynamic_exception_errc::underflow_error); |
| 3080 | } |
| 3081 | catch (const std::system_error& e) |
| 3082 | { |
| 3083 | return error{e.code()}; |
| 3084 | } |
| 3085 | catch (const std::runtime_error&) |
| 3086 | { |
| 3087 | return make_error(dynamic_exception_errc::runtime_error); |
| 3088 | } |
| 3089 | catch (const std::bad_array_new_length&) |
| 3090 | { |
| 3091 | return make_error(dynamic_exception_errc::bad_array_new_length); |
| 3092 | } |
| 3093 | catch (const std::bad_alloc&) |
| 3094 | { |
| 3095 | return make_error(dynamic_exception_errc::bad_alloc); |
| 3096 | } |
| 3097 | catch (const std::bad_typeid&) |
| 3098 | { |
no test coverage detected