aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-10-21 09:50:27 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-29 10:38:55 +0100
commite0284ab41f7a1889f28e719212df66e942959f4c (patch)
treedfbd27e96968c07d49372c6ed06f0b51f2c6c8b8 /src/qml/types
parent59cc901d3d15079b3666e5902b4c8b1a83ff1fd2 (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 <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/types')
-rw-r--r--src/qml/types/qquickworkerscript.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp
index 322b4b8df0..c0f6c737b2 100644
--- a/src/qml/types/qquickworkerscript.cpp
+++ b/src/qml/types/qquickworkerscript.cpp
@@ -230,8 +230,10 @@ void QQuickWorkerScriptEnginePrivate::WorkerEngine::init()
QV4::Scope scope(m_v4Engine);
onmessage = QV4::Script(m_v4Engine->rootContext, CALL_ONMESSAGE_SCRIPT).run();
+ Q_ASSERT(!scope.engine->hasException);
QV4::Script createsendscript(m_v4Engine->rootContext, SEND_MESSAGE_CREATE_SCRIPT);
QV4::Scoped<QV4::FunctionObject> createsendconstructor(scope, createsendscript.run());
+ Q_ASSERT(!scope.engine->hasException);
QV4::ScopedString name(scope, m_v4Engine->newString(QStringLiteral("sendMessage")));
QV4::ScopedValue function(scope, m_v4Engine->newBuiltinFunction(m_v4Engine->rootContext, name,
QQuickWorkerScriptEnginePrivate::method_sendMessage));
@@ -367,7 +369,7 @@ void QQuickWorkerScriptEnginePrivate::processMessage(int id, const QByteArray &d
callData->args[1] = value;
f->call(callData);
} catch (...) {
- QQmlError error = QV4::ExecutionEngine::convertJavaScriptException(ctx);
+ QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx);
reportScriptException(script, error);
}
}
@@ -400,11 +402,11 @@ void QQuickWorkerScriptEnginePrivate::processLoad(int id, const QUrl &url)
QV4::Script program(v4, activation, sourceCode, url.toString());
QV4::ExecutionContext *ctx = v4->current;
- try {
- program.parse();
+ program.parse();
+ if (!v4->hasException)
program.run();
- } catch (...) {
- QQmlError error = QV4::ExecutionEngine::convertJavaScriptException(ctx);
+ if (v4->hasException) {
+ QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx);
reportScriptException(script, error);
}
} else {