New fix for bug 351664 - Rethrown JavaScriptException's toString() returns "[object Error]"

git-svn-id: svn://10.0.0.236/trunk@257167 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
hannes%helma.at 2009-05-12 13:02:59 +00:00
parent cd140f15a2
commit ef46a2d0d9

View File

@ -76,18 +76,21 @@ public class JavaScriptException extends RhinoException
@Override
public String details()
{
try {
return ScriptRuntime.toString(value);
} catch (RuntimeException rte) {
// ScriptRuntime.toString may throw a RuntimeException
if (value == null) {
return "null";
} else if (value instanceof Scriptable) {
return ScriptRuntime.defaultObjectToString((Scriptable)value);
} else {
return value.toString();
}
}
if (value == null) {
return "null";
} else if (value instanceof NativeError) {
return value.toString();
}
try {
return ScriptRuntime.toString(value);
} catch (RuntimeException rte) {
// ScriptRuntime.toString may throw a RuntimeException
if (value instanceof Scriptable) {
return ScriptRuntime.defaultObjectToString((Scriptable)value);
} else {
return value.toString();
}
}
}
/**