mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
Add error handling to JSConsole
This commit is contained in:
parent
b658c26799
commit
0cd60782e7
2 changed files with 6 additions and 0 deletions
|
@ -59,6 +59,7 @@ JSConsole::JSConsole(QWidget* parent, ScriptEngine* scriptEngine) :
|
||||||
connect(_scriptEngine, SIGNAL(evaluationFinished(QScriptValue, bool)),
|
connect(_scriptEngine, SIGNAL(evaluationFinished(QScriptValue, bool)),
|
||||||
this, SLOT(handleEvalutationFinished(QScriptValue, bool)));
|
this, SLOT(handleEvalutationFinished(QScriptValue, bool)));
|
||||||
connect(_scriptEngine, SIGNAL(printedMessage(const QString&)), this, SLOT(handlePrint(const QString&)));
|
connect(_scriptEngine, SIGNAL(printedMessage(const QString&)), this, SLOT(handlePrint(const QString&)));
|
||||||
|
connect(_scriptEngine, SIGNAL(errorMessage(const QString&)), this, SLOT(handleError(const QString&)));
|
||||||
|
|
||||||
resizeTextInput();
|
resizeTextInput();
|
||||||
}
|
}
|
||||||
|
@ -96,6 +97,10 @@ void JSConsole::handleEvalutationFinished(QScriptValue result, bool isException)
|
||||||
appendMessage(gutter, resultStr);
|
appendMessage(gutter, resultStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void JSConsole::handleError(const QString& message) {
|
||||||
|
appendMessage(GUTTER_ERROR, "<span style='" + RESULT_ERROR_STYLE + "'>" + message.toHtmlEscaped() + "</span>");
|
||||||
|
}
|
||||||
|
|
||||||
void JSConsole::handlePrint(const QString& message) {
|
void JSConsole::handlePrint(const QString& message) {
|
||||||
appendMessage("", message);
|
appendMessage("", message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ protected slots:
|
||||||
void resizeTextInput();
|
void resizeTextInput();
|
||||||
void handleEvalutationFinished(QScriptValue result, bool isException);
|
void handleEvalutationFinished(QScriptValue result, bool isException);
|
||||||
void handlePrint(const QString& message);
|
void handlePrint(const QString& message);
|
||||||
|
void handleError(const QString& message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void appendMessage(const QString& gutter, const QString& message);
|
void appendMessage(const QString& gutter, const QString& message);
|
||||||
|
|
Loading…
Reference in a new issue