Showing the changes to libraries/script-engine/src/ScriptManager.cpp (1 of 2 files). Show all
Unified · Split
| @@ -228,6 +228,10 @@ QString ScriptManager::logException(const ScriptValue& exception) { · 227 unmodified lines | ||
| 228 | 228 | return message; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | +std::shared_ptr<ScriptException> ScriptManager::getUncaughtException() const { | |
| 232 | + return _engine->uncaughtException(); | |
| 233 | +} | |
| 234 | + | |
| 231 | 235 | ScriptManagerPointer scriptManagerFactory(ScriptManager::Context context, |
| 232 | 236 | const QString& scriptContents, |
| 233 | 237 | const QString& fileNameString) { |
| @@ -303,6 +307,9 @@ ScriptManager::ScriptManager(Context context, const QString& scriptContents, con · 69 unmodified lines | ||
| 303 | 307 | }); |
| 304 | 308 | #endif |
| 305 | 309 | |
| 310 | + // Forward exceptions from the scripting engine | |
| 311 | + connect(_engine.get(), &ScriptEngine::exception, this, &ScriptManager::unhandledException); | |
| 312 | + | |
| 306 | 313 | if (_type == Type::ENTITY_CLIENT || _type == Type::ENTITY_SERVER) { |
| 307 | 314 | QObject::connect(this, &ScriptManager::update, this, [this]() { |
| 308 | 315 | // process pending entity script content |
| @@ -902,7 +909,8 @@ void ScriptManager::run() { · 593 unmodified lines | ||
| 902 | 909 | |
| 903 | 910 | qCWarning(scriptengine) << "Engine has uncaught exception, stopping"; |
| 904 | 911 | stop(); |
| 905 | − _engine->clearExceptions(); | |
| 912 | + // V8TODO: Is clearing needed here? | |
| 913 | + //_engine->clearExceptions(); | |
| 906 | 914 | } |
| 907 | 915 | } |
| 908 | 916 | #ifdef _WIN32 |