Deduplicate QDebug output

This commit is contained in:
Dale Glass 2023-03-05 13:44:28 +01:00 committed by ksuprynowicz
parent 8d6270392d
commit b1e2a94d71

View file

@ -167,15 +167,11 @@ inline QDebug operator<<(QDebug debug, const ScriptException& e) {
// Is this a bad practice?
inline QDebug operator<<(QDebug debug, std::shared_ptr<ScriptException> e) {
debug << "Exception:"
<< e->errorMessage
<< (e->additionalInfo.isEmpty() ? QString("") : "[" + e->additionalInfo + "]")
<< " at line " << e->errorLine << ", column " << e->errorColumn;
if (e->backtrace.length()) {
debug << "Backtrace:";
debug << e->backtrace;
if (!e) {
debug << "[Null ScriptException]";
return debug;
}
debug << *e.get();
return debug;
}