MCPcopy Create free account
hub / github.com/celtera/libremidi / error_code_from_exception

Function error_code_from_exception

include/libremidi/system_error2.hpp:2945–3039  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2943}
2944
2945inline std::error_code error_code_from_exception(std::exception_ptr eptr) noexcept
2946{
2947 if (!eptr) return make_error_code(dynamic_exception_errc::bad_exception);
2948
2949 try
2950 {
2951 std::rethrow_exception(eptr);
2952 }
2953 catch (const std::domain_error&)
2954 {
2955 return make_error_code(dynamic_exception_errc::domain_error);
2956 }
2957 catch (const std::invalid_argument&)
2958 {
2959 return make_error_code(dynamic_exception_errc::invalid_argument);
2960 }
2961 catch (const std::length_error&)
2962 {
2963 return make_error_code(dynamic_exception_errc::length_error);
2964 }
2965 catch (const std::out_of_range&)
2966 {
2967 return make_error_code(dynamic_exception_errc::out_of_range);
2968 }
2969 catch (const std::logic_error&)
2970 {
2971 return make_error_code(dynamic_exception_errc::logic_error);
2972 }
2973 catch (const std::range_error&)
2974 {
2975 return make_error_code(dynamic_exception_errc::range_error);
2976 }
2977 catch (const std::overflow_error&)
2978 {
2979 return make_error_code(dynamic_exception_errc::overflow_error);
2980 }
2981 catch (const std::underflow_error&)
2982 {
2983 return make_error_code(dynamic_exception_errc::underflow_error);
2984 }
2985 catch (const std::system_error& e)
2986 {
2987 return e.code();
2988 }
2989 catch (const std::runtime_error&)
2990 {
2991 return make_error_code(dynamic_exception_errc::runtime_error);
2992 }
2993 catch (const std::bad_array_new_length&)
2994 {
2995 return make_error_code(dynamic_exception_errc::bad_array_new_length);
2996 }
2997 catch (const std::bad_alloc&)
2998 {
2999 return make_error_code(dynamic_exception_errc::bad_alloc);
3000 }
3001 catch (const std::bad_typeid&)
3002 {

Callers 2

from_exceptionMethod · 0.85
equivalentMethod · 0.85

Calls 1

make_error_codeFunction · 0.85

Tested by

no test coverage detected