Change JavaScriptException to include source and line information in Throwable.getMessage()
git-svn-id: svn://10.0.0.236/trunk@147876 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -120,9 +120,9 @@ public class EvaluatorException extends RuntimeException
|
||||
return lineSource;
|
||||
}
|
||||
|
||||
private static String generateErrorMessage(String message,
|
||||
String sourceName,
|
||||
int line)
|
||||
static String generateErrorMessage(String message,
|
||||
String sourceName,
|
||||
int line)
|
||||
{
|
||||
if (sourceName == null || line <= 0) {
|
||||
return message;
|
||||
@@ -131,10 +131,9 @@ public class EvaluatorException extends RuntimeException
|
||||
buf.append(" (");
|
||||
if (sourceName != null) {
|
||||
buf.append(sourceName);
|
||||
buf.append("; ");
|
||||
}
|
||||
if (line > 0) {
|
||||
buf.append("line ");
|
||||
buf.append('#');
|
||||
buf.append(line);
|
||||
}
|
||||
buf.append(')');
|
||||
|
||||
@@ -63,7 +63,8 @@ public class JavaScriptException extends Exception
|
||||
*/
|
||||
public JavaScriptException(Object value, String sourceName, int lineNumber)
|
||||
{
|
||||
super(ScriptRuntime.toString(value));
|
||||
super(EvaluatorException.generateErrorMessage(
|
||||
ScriptRuntime.toString(value), sourceName, lineNumber));
|
||||
this.lineNumber = lineNumber;
|
||||
this.sourceName = sourceName;
|
||||
this.value = value;
|
||||
|
||||
Reference in New Issue
Block a user