aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@theqtcompany.com>2015-01-05 15:31:20 +0100
committerKai Koehne <kai.koehne@theqtcompany.com>2015-01-09 13:14:21 +0100
commite2c1e7b8a274b2b00e19f00f0c24d9b17810f603 (patch)
tree4b2eab90482580d0d426cfc80581c3b51542571f
parent956d8b8025eb604673402e7cb0565b47d3169d67 (diff)
Print exceptions in JS slots
Do print JS exceptions raised in slots to the console, and clear the status afterwards. Otherwise exceptions raised might silently propagate to later JS calls. Change-Id: I122f3026aa18028415c5a4672cb3287e7d58ac4d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index f2c30e618f..db1315dc87 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -802,13 +802,17 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
f->call(callData);
if (scope.hasException() && v4->v8Engine) {
+ QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx);
+ if (error.description().isEmpty()) {
+ QV4::ScopedString name(scope, f->name());
+ error.setDescription(QString::fromLatin1("Unknown exception occurred during evaluation of connected function: %1").arg(name->toQString()));
+ }
if (QQmlEngine *qmlEngine = v4->v8Engine->engine()) {
- QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx);
- if (error.description().isEmpty()) {
- QV4::ScopedString name(scope, f->name());
- error.setDescription(QString(QLatin1String("Unknown exception occurred during evaluation of connected function: %1")).arg(name->toQString()));
- }
QQmlEnginePrivate::get(qmlEngine)->warning(error);
+ } else {
+ QMessageLogger(error.url().toString().toLatin1().constData(),
+ error.line(), 0).warning().noquote()
+ << error.toString();
}
}
}