1 22 23 24 package com.mchange.lang; 25 26 import java.io.*; 27 28 public class PotentiallySecondaryError extends Error implements PotentiallySecondary 29 { 30 final static String NESTED_MSG = ">>>>>>>>>> NESTED THROWABLE >>>>>>>>"; 31 32 Throwable nested; 33 34 public PotentiallySecondaryError(String msg, Throwable t) 35 { 36 super(msg); 37 this.nested = t; 38 } 39 40 public PotentiallySecondaryError(Throwable t) 41 {this("", t);} 42 43 public PotentiallySecondaryError(String msg) 44 {this(msg, null);} 45 46 public PotentiallySecondaryError() 47 {this("", null);} 48 49 public Throwable getNestedThrowable() 50 {return nested;} 51 52 public void printStackTrace(PrintWriter pw) 53 { 54 super.printStackTrace(pw); 55 if (nested != null) 56 { 57 pw.println(NESTED_MSG); 58 nested.printStackTrace(pw); 59 } 60 } 61 62 public void printStackTrace(PrintStream ps) 63 { 64 super.printStackTrace(ps); 65 if (nested != null) 66 { 67 ps.println("NESTED_MSG"); 68 nested.printStackTrace(ps); 69 } 70 } 71 72 public void printStackTrace() 73 {printStackTrace(System.err);} 74 } 75 | Popular Tags |