Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 6 files). Show all
Unified · Split
| @@ -145,6 +145,17 @@ QString encodeEntityIdIntoEntityUrl(const QString& url, const QString& entityID) · 144 unmodified lines | ||
| 145 | 145 | return url + " [EntityID:" + entityID + "]"; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | +void ScriptEngine::logConsoleException(QString message) { | |
| 149 | + this->raiseConsoleException(this->makeError(message)); | |
| 150 | +} | |
| 151 | + | |
| 152 | +QString ScriptEngine::logTraceException() { | |
| 153 | + QScriptValue value = this->raiseConsoleTraceException(this->makeError("")); | |
| 154 | + auto trace = formatTrace(value, _enableExtendedJSExceptions.get()); | |
| 155 | + scriptInfoMessage(trace); | |
| 156 | + return trace; | |
| 157 | +} | |
| 158 | + | |
| 148 | 159 | QString ScriptEngine::logException(const QScriptValue& exception) { |
| 149 | 160 | auto message = formatException(exception, _enableExtendedJSExceptions.get()); |
| 150 | 161 | scriptErrorMessage(message); |
| @@ -187,6 +198,15 @@ ScriptEngine::ScriptEngine(Context context, const QString& scriptContents, const · 36 unmodified lines | ||
| 187 | 198 | } |
| 188 | 199 | logException(output); |
| 189 | 200 | }); |
| 201 | + | |
| 202 | + // this is where all unhandled exceptions end up getting logged | |
| 203 | + /* connect(this, &BaseScriptEngine::unhandledException, this, [this](const QScriptValue& err) { | |
| 204 | + auto output = err.engine() == this ? err : makeError(err); | |
| 205 | + if (!output.property("detail").isValid()) { | |
| 206 | + output.setProperty("detail", "UnhandledException"); | |
| 207 | + } | |
| 208 | + logException(output); | |
| 209 | + });*/ | |
| 190 | 210 | } |
| 191 | 211 | |
| 192 | 212 | QString ScriptEngine::getContext() const { |