Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 2 files). Show all
Unified · Split
| @@ -304,6 +304,18 @@ void ScriptEngine::evaluate() { · 303 unmodified lines | ||
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | +QScriptValue ScriptEngine::evaluate(const QString& program, const QString& fileName, int lineNumber) { | |
| 308 | + QScriptValue result = _engine.evaluate(program, fileName, lineNumber); | |
| 309 | + bool hasUncaughtException = _engine.hasUncaughtException(); | |
| 310 | + if (hasUncaughtException) { | |
| 311 | + int line = _engine.uncaughtExceptionLineNumber(); | |
| 312 | + qDebug() << "Uncaught exception at line" << line << ": " << result.toString(); | |
| 313 | + } | |
| 314 | + emit evaluationFinished(result, hasUncaughtException); | |
| 315 | + _engine.clearExceptions(); | |
| 316 | + return result; | |
| 317 | +} | |
| 318 | + | |
| 307 | 319 | void ScriptEngine::sendAvatarIdentityPacket() { |
| 308 | 320 | if (_isAvatar && _avatarData) { |
| 309 | 321 | _avatarData->sendIdentityPacket(); |