diff options
author | Matthew Vogt <matthew.vogt@nokia.com> | 2012-07-06 13:04:53 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-11 01:49:59 +0200 |
commit | a1a2c81d7fd5512b8c0531b01453656fc4c96bed (patch) | |
tree | 519b6c02482c3487d64a060041e95ae09a878c49 /src/qml/qml/qqmlvme.cpp | |
parent | f5cb65b35e076facbce45e896902a34da7036135 (diff) |
Improved error messages for malformed .import statements
Report errors in .import statements, rather than pass them through
to V8 to yield 'Syntax error'.
Task-number: QTBUG-24867
Change-Id: I111b3bd3d198e97f42b29591f61753e86295aeb2
Reviewed-by: Glenn Watson <glenn.watson@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlvme.cpp')
-rw-r--r-- | src/qml/qml/qqmlvme.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp index 7a6d00835e..b33f7eed0f 100644 --- a/src/qml/qml/qqmlvme.cpp +++ b/src/qml/qml/qqmlvme.cpp @@ -1160,10 +1160,17 @@ v8::Persistent<v8::Object> QQmlVME::run(QQmlContextData *parentCtxt, QQmlScriptD if (script->m_loaded) return qPersistentNew<v8::Object>(script->m_value); + v8::Persistent<v8::Object> rv; + Q_ASSERT(parentCtxt && parentCtxt->engine); QQmlEnginePrivate *ep = QQmlEnginePrivate::get(parentCtxt->engine); QV8Engine *v8engine = ep->v8engine(); + if (script->hasError()) { + ep->warning(script->error()); + return rv; + } + bool shared = script->pragmas & QQmlScript::Object::ScriptBlock::Shared; QQmlContextData *effectiveCtxt = parentCtxt; @@ -1222,8 +1229,6 @@ v8::Persistent<v8::Object> QQmlVME::run(QQmlContextData *parentCtxt, QQmlScriptD Q_ASSERT(try_catch.HasCaught()); } - v8::Persistent<v8::Object> rv; - if (try_catch.HasCaught()) { v8::Local<v8::Message> message = try_catch.Message(); if (!message.IsEmpty()) { |