mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 00:13:53 +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)),
|
||||
this, SLOT(handleEvalutationFinished(QScriptValue, bool)));
|
||||
connect(_scriptEngine, SIGNAL(printedMessage(const QString&)), this, SLOT(handlePrint(const QString&)));
|
||||
connect(_scriptEngine, SIGNAL(errorMessage(const QString&)), this, SLOT(handleError(const QString&)));
|
||||
|
||||
resizeTextInput();
|
||||
}
|
||||
|
@ -96,6 +97,10 @@ void JSConsole::handleEvalutationFinished(QScriptValue result, bool isException)
|
|||
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) {
|
||||
appendMessage("", message);
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ protected slots:
|
|||
void resizeTextInput();
|
||||
void handleEvalutationFinished(QScriptValue result, bool isException);
|
||||
void handlePrint(const QString& message);
|
||||
void handleError(const QString& message);
|
||||
|
||||
private:
|
||||
void appendMessage(const QString& gutter, const QString& message);
|
||||
|
|
Loading…
Reference in a new issue