Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib/libexceptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ var LibraryExceptions = {
var info = new ExceptionInfo(ptr);
info.set_rethrown(true);
info.set_caught(false);
uncaughtExceptionCount++;
#if !DISABLE_EXCEPTION_CATCHING
___cxa_increment_exception_refcount(ptr);
exceptionLast = new CppException(ptr);
Expand Down
27 changes: 27 additions & 0 deletions test/core/test_exceptions_uncaught_4.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <stdexcept>
#include <stdio.h>

struct DestructorTester {
~DestructorTester() {
printf("Destructor Uncaught: %d\n", std::uncaught_exceptions());
}
};

int main() {
std::exception_ptr p;
try {
throw std::runtime_error("test");
} catch (...) {
p = std::current_exception();
}

printf("Before Uncaught: %d\n", std::uncaught_exceptions());
try {
DestructorTester dt;
std::rethrow_exception(p);
} catch (...) {
printf("In catch Uncaught: %d\n", std::uncaught_exceptions());
}
printf("After Uncaught: %d\n", std::uncaught_exceptions());
return 0;
}
4 changes: 4 additions & 0 deletions test/core/test_exceptions_uncaught_4.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Before Uncaught: 0
Destructor Uncaught: 1
In catch Uncaught: 0
After Uncaught: 0
8 changes: 6 additions & 2 deletions test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1457,8 +1457,12 @@ def test_exceptions_rethrow(self):
self.do_core_test('test_exceptions_rethrow.cpp')

@with_all_eh_sjlj
def test_exceptions_uncaught_count(self):
self.do_core_test('test_exceptions_uncaught_count.cpp')
def test_exceptions_uncaught_3(self):
self.do_core_test('test_exceptions_uncaught_3.cpp')

@with_all_eh_sjlj
def test_exceptions_uncaught_4(self):
self.do_core_test('test_exceptions_uncaught_4.cpp')

@with_all_eh_sjlj
def test_exceptions_resume(self):
Expand Down
Loading