History

Review fix: add flag to choose whether to abort script on exception

Dale Glass committed 3 years ago

Commit acd19f71 parent aec756b4 files · +34 −6Browse files

Showing the changes to libraries/script-engine/src/ScriptManager.cpp (1 of 4 files). Show all

Unified · Split

libraries/script-engine/src/ScriptManager.cpp+5−4
@@ -305,9 +305,10 @@ ScriptManager::ScriptManager(Context context, const QString& scriptContents, con · 304 unmodified lines
305305 }
306306
307307 // Unhandled exception kills the running script
308− stop(false);
309−
310− logException(output);
308+ if (_abortOnUncaughtException) {
309+ stop(false);
310+ logException(output);
311+ }
311312 });
312313 #endif
313314
@@ -909,7 +910,7 @@ void ScriptManager::run() { · 595 unmodified lines
909910 PROFILE_RANGE(script, _fileNameString);
910911 _returnValue = _engine->evaluate(_scriptContents, _fileNameString);
911912
912− if (_engine->hasUncaughtException()) {
913+ if (_engine->hasUncaughtException() && _abortOnUncaughtException) {
913914
914915 qCWarning(scriptengine) << "Engine has uncaught exception, stopping";
915916 stop();