DulcetAirman icon

StackTraceHelper

DulcetAirman | PRO | 12/27/14 10:41:05 AM UTC | 0 ⭐ | 686 👁️ | Never ⏰ | []
Java |

660 B

|

None

|

0 👍

/

0 👎

/** To process a stacktrace. */
public interface StackTraceHelper {
  public StackTraceData process(Throwable t);
  public StackTraceData process(StackTraceElement[] stacktrace);
}
/** the result of the stack trace helper. */
public interface StackTraceData {
  /** prints to given stream. e.g. System.err*/
  public void print(PrintStream out);
  /** Returns the result as readable text, including suggestions and useful links. */
  public String getAnaysis();
}
// Usage:
StackTraceHelper sth = StackTraceHelperFactory.getDefaultInstance();
// ...
catch(Exception exception) {
  StackTraceData  data = sth.process(exception);
  data.print(System.err);
}

Comments