@@ -137,6 +137,45 @@ TEST_SUITE("execute_request")
137137 REQUIRE (result[" status" ] == " ok" );
138138 }
139139
140+ #if defined(XEUS_CPP_EMSCRIPTEN_WASM_BUILD)
141+ TEST_CASE (" Emscripten Exception Handling" )
142+ {
143+ std::vector<const char *> Args = {
144+ " -std=c++20" ,
145+ " -v" ,
146+ " -fwasm-exceptions" ,
147+ " -mllvm" , " -wasm-enable-sjlj"
148+ };
149+
150+ xcpp::interpreter interpreter ((int )Args.size (), Args.data ());
151+ std::string code = " try { throw 1; } catch (...) { 0; }" ;
152+ nl::json user_expressions = nl::json::object ();
153+ xeus::execute_request_config config;
154+ config.silent = false ;
155+ config.store_history = false ;
156+ config.allow_stdin = false ;
157+ nl::json header = nl::json::object ();
158+ xeus::xrequest_context::guid_list id = {};
159+ xeus::xrequest_context context (header, id);
160+
161+ std::promise<nl::json> promise;
162+ std::future<nl::json> future = promise.get_future ();
163+ auto callback = [&promise](nl::json result) {
164+ promise.set_value (result);
165+ };
166+
167+ interpreter.execute_request (
168+ std::move (context),
169+ std::move (callback),
170+ code,
171+ std::move (config),
172+ user_expressions
173+ );
174+ nl::json result = future.get ();
175+ REQUIRE (result[" status" ] == " ok" );
176+ }
177+ #endif
178+
140179 TEST_CASE (" fetch_documentation" )
141180 {
142181 std::vector<const char *> Args = {/* "-v", "resource-dir", "....."*/ };
0 commit comments