public String getErrorSourceFile() { if ( node != null ) return node.getSourceFile() ; else return "<unknown file>"; }
/** Get the name of the source file (or more generally source) of the text from which this node was parsed. This will recursively search up the chain of parent nodes until a source is found or return a string indicating that the source is unknown. */ public String getSourceFile() { if ( sourceFile == null ) if ( parent != null ) return ((SimpleNode)parent).getSourceFile(); else return "<unknown file>"; else return sourceFile; }
/** Print the error with line number and stack trace. */ public String getMessage() { String trace; if ( node != null ) trace = " : at Line: "+ node.getLineNumber() + " : in file: "+ node.getSourceFile() + " : "+node.getText(); else // Users should not normally see this. trace = ": <at unknown location>"; if ( callstack != null ) trace = trace +"\n" + getScriptStackTrace(); return getRawMessage() + trace; }
public String getScriptStackTrace() { if ( callstack == null ) return "<Unknown>"; String trace = ""; CallStack stack = callstack.copy(); while ( stack.depth() > 0 ) { NameSpace ns = stack.pop(); SimpleNode node = ns.getNode(); if ( ns.isMethod ) { trace = trace + "\nCalled from method: " + ns.getName(); if ( node != null ) trace += " : at Line: "+ node.getLineNumber() + " : in file: "+ node.getSourceFile() + " : "+node.getText(); } } return trace; }