From dd214ca247a9b17049cdde7b762c118244e90437 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 21 Dec 2016 18:21:20 +0300 Subject: [PATCH] init script error message has been added --- limereport/lrreportrender.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 1f656eb..e768e10 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -167,9 +167,17 @@ void ReportRender::setScriptContext(ScriptEngineContext* scriptContext) bool ReportRender::runInitScript(){ if (m_scriptEngineContext){ - ScriptEngineManager::instance().scriptEngine()->pushContext(); - QScriptValue res = ScriptEngineManager::instance().scriptEngine()->evaluate(m_scriptEngineContext->initScript()); + QScriptEngine* engine = ScriptEngineManager::instance().scriptEngine(); + engine->pushContext(); + QScriptValue res = engine->evaluate(m_scriptEngineContext->initScript()); if (res.isBool()) return res.toBool(); + if (engine->hasUncaughtException()) { + QMessageBox::critical(0,tr("Error"), + QString("Line %1: %2 ").arg(engine->uncaughtExceptionLineNumber()) + .arg(engine->uncaughtException().toString()) + ); + return false; + } } return true; }