Formatted message

This commit is contained in:
fanchao 2024-05-29 14:09:48 +10:00
parent 036b13084f
commit c899d723b7

View File

@ -40,9 +40,10 @@ namespace jni_utils {
return run_catching_cxx_exception_or<RetT>(f, [env](const char *msg) { return run_catching_cxx_exception_or<RetT>(f, [env](const char *msg) {
jclass exceptionClass = env->FindClass("java/lang/RuntimeException"); jclass exceptionClass = env->FindClass("java/lang/RuntimeException");
if (msg) { if (msg) {
env->ThrowNew(exceptionClass, msg); auto formatted_message = std::string("libsession: C++ exception: ") + msg;
env->ThrowNew(exceptionClass, formatted_message.c_str());
} else { } else {
env->ThrowNew(exceptionClass, "Unknown C++ exception from libsession"); env->ThrowNew(exceptionClass, "libsession: Unknown C++ exception");
} }
return RetT(); return RetT();