History

Clear script engine errors once they have been reported

So that an error is not repeatedly reported to the console and log file. Also consistently report filename. And scripts included after one in error will now be run.

David Rowe committed 12 years ago

Commit e92ad861 parent 3b4ac911 file · +11 −8Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+11−8
@@ -314,8 +314,9 @@ void ScriptEngine::evaluate() { · 313 unmodified lines
314 314
315 if (_engine.hasUncaughtException()) {315 if (_engine.hasUncaughtException()) {
316 int line = _engine.uncaughtExceptionLineNumber();316 int line = _engine.uncaughtExceptionLineNumber();
317 qDebug() << "Uncaught exception at line" << line << ":" << result.toString();317 qDebug() << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << result.toString();
318 emit errorMessage("Uncaught exception at line" + QString::number(line) + ":" + result.toString());318 emit errorMessage("Uncaught exception at (" + _fileNameString + ") line" + QString::number(line) + ":" + result.toString());
319 _engine.clearExceptions();
319 }320 }
320}321}
321 322
@@ -324,7 +325,7 @@ QScriptValue ScriptEngine::evaluate(const QString& program, const QString& fileN · 2 unmodified lines
324 bool hasUncaughtException = _engine.hasUncaughtException();325 bool hasUncaughtException = _engine.hasUncaughtException();
325 if (hasUncaughtException) {326 if (hasUncaughtException) {
326 int line = _engine.uncaughtExceptionLineNumber();327 int line = _engine.uncaughtExceptionLineNumber();
327 qDebug() << "Uncaught exception at line" << line << ": " << result.toString();328 qDebug() << "Uncaught exception at (" << _fileNameString << ") line" << line << ": " << result.toString();
328 }329 }
329 emit evaluationFinished(result, hasUncaughtException);330 emit evaluationFinished(result, hasUncaughtException);
330 _engine.clearExceptions();331 _engine.clearExceptions();
@@ -353,9 +354,9 @@ void ScriptEngine::run() { · 22 unmodified lines
353 QScriptValue result = _engine.evaluate(_scriptContents);354 QScriptValue result = _engine.evaluate(_scriptContents);
354 if (_engine.hasUncaughtException()) {355 if (_engine.hasUncaughtException()) {
355 int line = _engine.uncaughtExceptionLineNumber();356 int line = _engine.uncaughtExceptionLineNumber();
356 357 qDebug() << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << result.toString();
357 qDebug() << "Uncaught exception at line" << line << ":" << result.toString();358 emit errorMessage("Uncaught exception at (" + _fileNameString + ") line" + QString::number(line) + ":" + result.toString());
358 emit errorMessage("Uncaught exception at line" + QString::number(line) + ":" + result.toString());359 _engine.clearExceptions();
359 }360 }
360 361
361 QElapsedTimer startTime;362 QElapsedTimer startTime;
@@ -495,8 +496,9 @@ void ScriptEngine::run() { · 133 unmodified lines
495 496
496 if (_engine.hasUncaughtException()) {497 if (_engine.hasUncaughtException()) {
497 int line = _engine.uncaughtExceptionLineNumber();498 int line = _engine.uncaughtExceptionLineNumber();
498 qDebug() << "Uncaught exception at line" << line << ":" << _engine.uncaughtException().toString();499 qDebug() << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << _engine.uncaughtException().toString();
499 emit errorMessage("Uncaught exception at line" + QString::number(line) + ":" + _engine.uncaughtException().toString());500 emit errorMessage("Uncaught exception at (" + _fileNameString + ") line" + QString::number(line) + ":" + _engine.uncaughtException().toString());
501 _engine.clearExceptions();
500 }502 }
501 }503 }
502 emit scriptEnding();504 emit scriptEnding();
@@ -656,5 +658,6 @@ void ScriptEngine::include(const QString& includeFile) { · 153 unmodified lines
656 int line = _engine.uncaughtExceptionLineNumber();658 int line = _engine.uncaughtExceptionLineNumber();
657 qDebug() << "Uncaught exception at (" << includeFile << ") line" << line << ":" << result.toString();659 qDebug() << "Uncaught exception at (" << includeFile << ") line" << line << ":" << result.toString();
658 emit errorMessage("Uncaught exception at (" + includeFile + ") line" + QString::number(line) + ":" + result.toString());660 emit errorMessage("Uncaught exception at (" + includeFile + ") line" + QString::number(line) + ":" + result.toString());
661 _engine.clearExceptions();
659 }662 }
660}663}