1 package net.sourceforge.jparam; 2 3 import java.io.PrintStream; 4 5 public class JParamException extends Exception { 6 private Throwable nestedException = null; 7 8 private String debugMessage; 9 10 public JParamException(String message, String debugMessage) { 11 super(message); 12 this.debugMessage = debugMessage; 13 } 14 15 public JParamException(String message) { 16 this(message, (String) null); 17 } 18 19 public JParamException(String message, Throwable nestedException) { 20 this(message, null, nestedException); 21 } 22 23 public JParamException(String message, String debugMessage, 24 Throwable nestedException) { 25 this(message, debugMessage); 26 this.nestedException = nestedException; 27 } 28 29 public void printStackTrace(PrintStream s) { 30 super.printStackTrace(s); 31 32 if (debugMessage != null) { 33 s.println(" Debug MSG: " + debugMessage); 34 } 35 36 if (nestedException != null) { 37 s.println("Nested Exception: "); 38 nestedException.printStackTrace(s); 39 } 40 } 41 }