diff options
author | Mark Visser <mjmvisser@gmail.com> | 2013-04-30 14:12:37 -0400 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-08 10:46:13 +0200 |
commit | 13afb2b49daec9f5f65dc9a99151c91d685dce13 (patch) | |
tree | 79c00dec10a6d90152213c0a85fafe6a9a480a95 /src/qml/qml/qqmljavascriptexpression.cpp | |
parent | 22fc92cf9187460785a05e31620823fe8afe5eab (diff) |
QQmlError.object now holds the scope object that caused exceptions.
Exception errors sent via QQmlEngine::warnings lacked a pointer to the
containing scope. I added an object property to QQmlError, and the
necessary code to fill it with the QObject* scope from binding exception
callbacks.
Task-number: QTBUG-30930
Change-Id: I2a987e8cefc3a2a474d338893e9ebcb77c167adf
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'src/qml/qml/qqmljavascriptexpression.cpp')
-rw-r--r-- | src/qml/qml/qqmljavascriptexpression.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index 4568307d5b..2a1ed1406a 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -79,6 +79,11 @@ void QQmlDelayedError::setErrorDescription(const QString &description) m_error.setDescription(description); } +void QQmlDelayedError::setErrorObject(QObject *object) +{ + m_error.setObject(object); +} + /* Converting from a message to an error is relatively expensive. @@ -348,6 +353,7 @@ QQmlJavaScriptExpression::evalFunction(QQmlContextData *ctxt, QObject *scope, error.setDescription(QLatin1String("Exception occurred during function compilation")); error.setLine(line); error.setUrl(QUrl::fromLocalFile(filename)); + error.setObject(scope); v8::Local<v8::Message> message = tc.Message(); if (!message.IsEmpty()) QQmlExpressionPrivate::exceptionToError(message, error); @@ -360,6 +366,7 @@ QQmlJavaScriptExpression::evalFunction(QQmlContextData *ctxt, QObject *scope, error.setDescription(QLatin1String("Exception occurred during function evaluation")); error.setLine(line); error.setUrl(QUrl::fromLocalFile(filename)); + error.setObject(scope); v8::Local<v8::Message> message = tc.Message(); if (!message.IsEmpty()) QQmlExpressionPrivate::exceptionToError(message, error); @@ -390,6 +397,7 @@ QQmlJavaScriptExpression::evalFunction(QQmlContextData *ctxt, QObject *scope, error.setDescription(QLatin1String("Exception occurred during function compilation")); error.setLine(line); error.setUrl(QUrl::fromLocalFile(filename)); + error.setObject(scope); v8::Local<v8::Message> message = tc.Message(); if (!message.IsEmpty()) QQmlExpressionPrivate::exceptionToError(message, error); @@ -402,6 +410,7 @@ QQmlJavaScriptExpression::evalFunction(QQmlContextData *ctxt, QObject *scope, error.setDescription(QLatin1String("Exception occurred during function evaluation")); error.setLine(line); error.setUrl(QUrl::fromLocalFile(filename)); + error.setObject(scope); v8::Local<v8::Message> message = tc.Message(); if (!message.IsEmpty()) QQmlExpressionPrivate::exceptionToError(message, error); |