show file name in error message; can't backport this to the 4.4 branch since it changes a translated string, will do something slightly different in the 4.4 branch instead.

BUG:227137

svn path=/trunk/KDE/kdebase/runtime/; revision=1091105
This commit is contained in:
Aaron J. Seigo 2010-02-16 17:48:54 +00:00
parent ce64431653
commit 66d58f1229

View File

@ -109,9 +109,16 @@ void SimpleJavaScriptApplet::engineReportsError(ScriptEnv *engine, bool fatal)
void SimpleJavaScriptApplet::reportError(QScriptEngine *engine, bool fatal)
{
SimpleJavaScriptApplet *jsApplet = qobject_cast<SimpleJavaScriptApplet *>(engine->parent());
const QString failureMsg = i18n("Script failure on line %1:\n%2",
QString::number(engine->uncaughtExceptionLineNumber()),
engine->uncaughtException().toString());
AppletInterface *interface = extractAppletInterface(engine);
const QScriptValue error = engine->uncaughtException();
QString file = error.property("fileName").toString();
if (interface) {
file.remove(interface->package()->path());
}
const QString failureMsg = i18n("Error in %1 on line %2.<br><br>%3",
file, error.property("lineNumber").toString(),
error.toString());
if (jsApplet) {
if (fatal) {
jsApplet->setFailedToLaunch(true, failureMsg);
@ -666,4 +673,4 @@ QScriptValue SimpleJavaScriptApplet::variantToScriptValue(QVariant var)
}
K_EXPORT_PLASMA_APPLETSCRIPTENGINE(qscriptapplet, SimpleJavaScriptApplet)
#include "simplejavascriptapplet.moc"