diff options
Diffstat (limited to 'src/qml/jsapi/qjsengine.cpp')
-rw-r--r-- | src/qml/jsapi/qjsengine.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp index f0e3e69fbb..37b5306897 100644 --- a/src/qml/jsapi/qjsengine.cpp +++ b/src/qml/jsapi/qjsengine.cpp @@ -939,6 +939,20 @@ void QJSEngine::throwError(QJSValue::ErrorType errorType, const QString &message } /*! + \overload throwError() + + Throws a pre-constructed run-time \a error (exception). This way you can + use \l newErrorObject() to create the error and customize it as necessary. + + \since 6.1 + \sa {Script Exceptions}, newErrorObject() +*/ +void QJSEngine::throwError(const QJSValue &error) +{ + m_v4Engine->throwError(QJSValuePrivate::asReturnedValue(&error)); +} + +/*! * Returns \c true if the last JavaScript execution resulted in an exception or * if throwError() was called. Otherwise returns \c false. Mind that evaluate() * catches any exceptions thrown in the evaluated code. |