| 108 | } |
| 109 | |
| 110 | Runtime* TryGetRuntime(int runtimeId) { |
| 111 | Runtime* runtime = nullptr; |
| 112 | try { |
| 113 | runtime = Runtime::GetRuntime(runtimeId); |
| 114 | } catch (NativeScriptException& e) { |
| 115 | e.ReThrowToJava(); |
| 116 | } catch (std::exception e) { |
| 117 | stringstream ss; |
| 118 | ss << "Error: c++ exception: " << e.what() << endl; |
| 119 | NativeScriptException nsEx(ss.str()); |
| 120 | nsEx.ReThrowToJava(); |
| 121 | } catch (...) { |
| 122 | NativeScriptException nsEx(std::string("Error: c++ exception!")); |
| 123 | nsEx.ReThrowToJava(); |
| 124 | } |
| 125 | return runtime; |
| 126 | } |
| 127 | |
| 128 | extern "C" JNIEXPORT void Java_com_tns_Runtime_runModule(JNIEnv* _env, jobject obj, jint runtimeId, jstring scriptFile) { |
| 129 | auto runtime = TryGetRuntime(runtimeId); |
no test coverage detected