diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-10-22 14:32:03 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-29 10:39:04 +0100 |
commit | 25fbdfc66fa995bfe633b3c31d635045f7cf66dd (patch) | |
tree | 3264a851680476ebb7f161d5a38dcff3182a0e8a /src/qml/qml/qqmljavascriptexpression.cpp | |
parent | ffcdbfa03f8bb36b521f8c1a703ee24085fe25bd (diff) |
Fix the remaining try/catch statements in C++
Change-Id: I2421dc48fb271b66bd476fb16a32a88fcc4c5177
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmljavascriptexpression.cpp')
-rw-r--r-- | src/qml/qml/qqmljavascriptexpression.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index d115268ab0..79b7aa2e7a 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -159,28 +159,27 @@ QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QQmlContextData *context, QV4::Scope scope(v4); QV4::ScopedValue result(scope, QV4::Primitive::undefinedValue()); QV4::ExecutionContext *ctx = v4->current; - try { - callData->thisObject = ep->v8engine()->global(); - if (scopeObject() && requiresThisObject()) { - QV4::ScopedValue value(scope, QV4::QObjectWrapper::wrap(ctx->engine, scopeObject())); - if (value->isObject()) - callData->thisObject = value; - } - - result = function->asFunctionObject()->call(callData); - - if (isUndefined) - *isUndefined = result->isUndefined(); + callData->thisObject = ep->v8engine()->global(); + if (scopeObject() && requiresThisObject()) { + QV4::ScopedValue value(scope, QV4::QObjectWrapper::wrap(ctx->engine, scopeObject())); + if (value->isObject()) + callData->thisObject = value; + } - if (!watcher.wasDeleted() && hasDelayedError()) - delayedError()->clearError(); - } catch (...) { + result = function->asFunctionObject()->call(callData); + if (scope.hasException()) { if (watcher.wasDeleted()) ctx->catchException(); // ignore exception else delayedError()->catchJavaScriptException(ctx); if (isUndefined) *isUndefined = true; + } else { + if (isUndefined) + *isUndefined = result->isUndefined(); + + if (!watcher.wasDeleted() && hasDelayedError()) + delayedError()->clearError(); } if (capture.errorString) { |