in cxx/fbjni/detail/Exceptions.cpp [261:302]
local_ref<JThrowable> convertCppExceptionToJavaException(std::exception_ptr ptr) {
FBJNI_ASSERT(ptr);
local_ref<JThrowable> current;
bool addCppStack = true;
try {
std::rethrow_exception(ptr);
addCppStack = false;
} catch (const JniException& ex) {
current = ex.getThrowable();
} catch (const std::ios_base::failure& ex) {
current = JIOException::create(ex.what());
} catch (const std::bad_alloc& ex) {
current = JOutOfMemoryError::create(ex.what());
} catch (const std::out_of_range& ex) {
current = JArrayIndexOutOfBoundsException::create(ex.what());
} catch (const std::system_error& ex) {
current = JCppSystemErrorException::create(ex);
} catch (const std::runtime_error& ex) {
current = JRuntimeException::create(ex.what());
} catch (const std::exception& ex) {
current = JCppException::create(ex.what());
} catch (const char* msg) {
current = JUnknownCppException::create(msg);
} catch (...) {
#ifdef _WIN32
current = JUnknownCppException::create();
#else
const std::type_info* tinfo = abi::__cxa_current_exception_type();
if (tinfo) {
std::string msg = std::string("Unknown: ") + tinfo->name();
current = JUnknownCppException::create(msg.c_str());
} else {
current = JUnknownCppException::create();
}
#endif
}
if (addCppStack) {
addCppStacktraceToJavaException(current, ptr);
}
return current;
}