aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4engine.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-08-01 16:31:53 +0200
committerJani Heikkinen <jani.heikkinen@qt.io>2018-10-30 12:41:54 +0000
commit7f0db6d0472037a3ec005f9066f6222d78de60e1 (patch)
tree30e2acee27523678f56ae2a9dc61847cace7c287 /src/qml/jsruntime/qv4engine.cpp
parentb190d0d160e1cf5bbe65f8ff54752e8a7d33b49b (diff)
Add convenience functions for creating and inspecting error objects
Serves to simplify porting from QtScript by replacing QScriptContext::Error and QScriptContext::throwError(). Change-Id: I4bfe404c358c50aaf3b5469a4304fec97552bf24 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r--src/qml/jsruntime/qv4engine.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 129bb20019..169ab0a4a4 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -849,6 +849,11 @@ Heap::Object *ExecutionEngine::newErrorObject(const Value &value)
return ErrorObject::create<ErrorObject>(this, value, errorCtor());
}
+Heap::Object *ExecutionEngine::newErrorObject(const QString &message)
+{
+ return ErrorObject::create<ErrorObject>(this, message);
+}
+
Heap::Object *ExecutionEngine::newSyntaxErrorObject(const QString &message)
{
return ErrorObject::create<SyntaxErrorObject>(this, message);
@@ -918,6 +923,16 @@ Promise::ReactionHandler *ExecutionEngine::getPromiseReactionHandler()
return m_reactionHandler.data();
}
+Heap::Object *ExecutionEngine::newURIErrorObject(const QString &message)
+{
+ return ErrorObject::create<URIErrorObject>(this, message);
+}
+
+Heap::Object *ExecutionEngine::newEvalErrorObject(const QString &message)
+{
+ return ErrorObject::create<EvalErrorObject>(this, message);
+}
+
Heap::Object *ExecutionEngine::newVariantObject(const QVariant &v)
{
return memoryManager->allocate<VariantObject>(v);