Skip to content

Commit 1f100ec

Browse files
committed
added catching all exceptions, can be disabled by not defining PYTHONQT_CATCH_ALL_EXCEPTIONS
1 parent f3bcda8 commit 1f100ec

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/PythonQtSlot.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ bool PythonQtCallSlot(PythonQtClassInfo* classInfo, QObject* objectToCall, PyObj
205205
QByteArray what("std::exception: ");
206206
what += e.what();
207207
PyErr_SetString(PyExc_RuntimeError, what.constData());
208+
#ifdef PYTHONQT_CATCH_ALL_EXCEPTIONS
209+
} catch (...) {
210+
hadException = true;
211+
PyErr_SetString(PyExc_RuntimeError, "Unknown C++ exception.");
212+
#endif
208213
}
209214
}
210215

src/src.pro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ isEmpty(PYTHONQT_STATIC) {
2222
CONFIG += static
2323
}
2424

25+
DEFINES += PYTHONQT_CATCH_ALL_EXCEPTIONS
26+
2527
contains(QT_MAJOR_VERSION, 5) {
2628
QT += widgets core-private
2729
}

0 commit comments

Comments
 (0)