diff options
author | Lars Knoll <[email protected]> | 2013-10-21 09:50:27 +0200 |
---|---|---|
committer | The Qt Project <[email protected]> | 2013-10-29 10:38:55 +0100 |
commit | e0284ab41f7a1889f28e719212df66e942959f4c (patch) | |
tree | dfbd27e96968c07d49372c6ed06f0b51f2c6c8b8 /src/qml/jsapi/qjsengine.cpp | |
parent | 59cc901d3d15079b3666e5902b4c8b1a83ff1fd2 (diff) |
Properly propagate parse errors
Replace all try/catch statements used when parsing
with checks for engine->hasException.
Change-Id: I4493cb600d5a3eb095c2003bb88bd031403e47c9
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsapi/qjsengine.cpp')
-rw-r--r-- | src/qml/jsapi/qjsengine.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp index d1bd4934cd..5d8a0202fa 100644 --- a/src/qml/jsapi/qjsengine.cpp +++ b/src/qml/jsapi/qjsengine.cpp @@ -262,15 +262,15 @@ QJSValue QJSEngine::evaluate(const QString& program, const QString& fileName, in QV4::Scope scope(d->m_v4Engine); QV4::ExecutionContext *ctx = d->m_v4Engine->current; QV4::ScopedValue result(scope); - try { - QV4::Script script(ctx, program, fileName, lineNumber); - script.strictMode = ctx->strictMode; - script.inheritContext = true; - script.parse(); + + QV4::Script script(ctx, program, fileName, lineNumber); + script.strictMode = ctx->strictMode; + script.inheritContext = true; + script.parse(); + if (!scope.engine->hasException) result = script.run(); - } catch (...) { + if (scope.engine->hasException) result = ctx->catchException(); - } return new QJSValuePrivate(d->m_v4Engine, result); } |