@@ -87,9 +87,9 @@ var LibraryExceptions = {
8787 '__cxa_increment_exception_refcount' ,
8888#endif
8989#if EXCEPTION_STACK_TRACES
90- // When EXCEPTION_STACK_TRACES is enabled, storeException contains a call to
91- // 'new CppException', whose constructor calls getExceptionMessage. We can't
92- // track the dependency there, so we track it here.
90+ // When EXCEPTION_STACK_TRACES is enabled the 'new CppException' constructor
91+ // calls getExceptionMessage. We can't track the dependency there, so we
92+ // track it here.
9393 '$getExceptionMessage' ,
9494 // These functions can be necessary to prevent memory leaks from the JS
9595 // side. Even though they are not used it here directly, we export them when
@@ -106,8 +106,8 @@ var LibraryExceptions = {
106106 info . init ( type , destructor ) ;
107107#if ! DISABLE_EXCEPTION_CATCHING
108108 ___cxa_increment_exception_refcount ( ptr ) ;
109+ exceptionLast = new CppException ( ptr ) ;
109110#endif
110- { { { storeException ( 'exceptionLast' , 'ptr' ) } } }
111111 uncaughtExceptionCount ++ ;
112112 { { { makeThrow ( 'exceptionLast' ) } } }
113113 } ,
@@ -140,7 +140,9 @@ var LibraryExceptions = {
140140 dbg ( '__cxa_rethrow, popped ' +
141141 [ ptrToString ( ptr ) , exceptionLast , 'stack' , exceptionCaught ] ) ;
142142#endif
143- { { { storeException ( 'exceptionLast' , 'ptr' ) } } }
143+ #if ! DISABLE_EXCEPTION_CATCHING
144+ exceptionLast = new CppException ( ptr ) ;
145+ #endif
144146 { { { makeThrow ( 'exceptionLast' ) } } }
145147 } ,
146148
@@ -226,12 +228,7 @@ var LibraryExceptions = {
226228 // We'll do that here, instead, to keep things simpler.
227229 $findMatchingCatch__deps : [ '$exceptionLast' , '$ExceptionInfo' , '__cxa_can_catch' , '$setTempRet0' ] ,
228230 $findMatchingCatch : ( args ) = > {
229- var thrown =
230- #if EXCEPTION_STACK_TRACES
231- exceptionLast ?. excPtr ;
232- #else
233- exceptionLast ;
234- #endif
231+ var thrown = exceptionLast ?. excPtr ;
235232 if ( ! thrown ) {
236233 // just pass through the null ptr
237234 setTempRet0 ( 0 ) ;
@@ -277,9 +274,11 @@ var LibraryExceptions = {
277274#if EXCEPTION_DEBUG
278275 dbg ( "__resumeException " + [ ptrToString ( ptr ) , exceptionLast ] ) ;
279276#endif
277+ #if ! DISABLE_EXCEPTION_CATCHING
280278 if ( ! exceptionLast ) {
281- { { { storeException ( ' exceptionLast' , ' ptr' ) } } }
279+ exceptionLast = new CppException ( ptr ) ;
282280 }
281+ #endif
283282 { { { makeThrow ( 'exceptionLast' ) } } }
284283 } ,
285284
0 commit comments