public static void reportException(ErrorReporter er, RhinoException ex) { if (er instanceof ToolErrorReporter) { ((ToolErrorReporter)er).reportException(ex); } else { String msg = getExceptionMessage(ex); er.error(msg, ex.sourceName(), ex.lineNumber(), ex.lineSource(), ex.columnNumber()); } }
private static String getExceptionMessage(RhinoException ex) { String msg; if (ex instanceof JavaScriptException) { msg = getMessage("msg.uncaughtJSException", ex.details()); } else if (ex instanceof EcmaError) { msg = getMessage("msg.uncaughtEcmaError", ex.details()); } else if (ex instanceof EvaluatorException) { msg = ex.details(); } else { msg = ex.toString(); } return msg; }
/** * Get a string representing the script stack of this exception. * If optimization is enabled, this corresponds to all java stack elements * with a source name ending with ".js". * @return a script stack dump * @since 1.6R6 */ public String getScriptStackTrace() { return getScriptStackTrace(new FilenameFilter() { public boolean accept(File dir, String name) { return name.endsWith(".js"); } }); }
/** * Returns the line number of the source that was executing at the time of the exception. * * @return the line number or -1 if the exception was not thrown due to the * execution of a script. */ public int getFailingLineNumber() { if (getCause() instanceof RhinoException) { final RhinoException cause = (RhinoException) getCause(); return cause.lineNumber(); } return -1; }
lineNumber = e.lineNumber(); lineSource = e.lineSource(); savedState = null; throw e;
String sourceUri = re.sourceName(); if (sourceUri == null) { sourceUri = ""; int line = re.lineNumber(); Object args[]; if (line > 0) {
/** * Returns the column number of the source that was executing at the time of the exception. * * @return the column number or -1 if the exception was not thrown due to the * execution of a script. */ public int getFailingColumnNumber() { if (getCause() instanceof RhinoException) { final RhinoException cause = (RhinoException) getCause(); return cause.columnNumber(); } return -1; }
@Override public final String getMessage() { String details = details(); if (sourceName == null || lineNumber <= 0) { return details; } StringBuffer buf = new StringBuffer(details); buf.append(" ("); if (sourceName != null) { buf.append(sourceName); } if (lineNumber > 0) { buf.append('#'); buf.append(lineNumber); } buf.append(')'); return buf.toString(); }
/** * Returns the line number of the source that was executing at the time of the exception. * * @return the line number or -1 if the exception was not thrown due to the * execution of a script. */ public int getFailingLineNumber() { if (getCause() instanceof RhinoException) { final RhinoException cause = (RhinoException) getCause(); return cause.lineNumber(); } return -1; }
/** * Returns the column number of the source that was executing at the time of the exception. * * @return the column number or -1 if the exception was not thrown due to the * execution of a script. */ public int getFailingColumnNumber() { if (getCause() instanceof RhinoException) { final RhinoException cause = (RhinoException) getCause(); return cause.columnNumber(); } return -1; }
public void reportException(RhinoException ex) { if (ex instanceof WrappedException) { WrappedException we = (WrappedException)ex; we.printStackTrace(err); } else { String lineSeparator = SecurityUtilities.getSystemProperty("line.separator"); String msg = getExceptionMessage(ex) + lineSeparator + ex.getScriptStackTrace(); reportErrorMessage(msg, ex.sourceName(), ex.lineNumber(), ex.lineSource(), ex.columnNumber(), false); } }
/** * Returns the line number of the source that was executing at the time of the exception. * * @return the line number or -1 if the exception was not thrown due to the * execution of a script. */ public int getFailingLineNumber() { if (getCause() instanceof RhinoException) { final RhinoException cause = (RhinoException) getCause(); return cause.lineNumber(); } return -1; }
/** * Returns the line number of the source that was executing at the time of the exception. * * @return the line number or -1 if the exception was not thrown due to the * execution of a script. */ public int getFailingLineNumber() { if (getCause() instanceof RhinoException) { final RhinoException cause = (RhinoException) getCause(); return cause.lineNumber(); } return -1; }
/** * Returns the line number of the source that was executing at the time of the exception. * * @return the line number or -1 if the exception was not thrown due to the * execution of a script. */ public int getFailingLineNumber() { if (getCause() instanceof RhinoException) { final RhinoException cause = (RhinoException) getCause(); return cause.lineNumber(); } return -1; }