1 2 24 25 package com.lutris.util; 26 27 import java.io.PrintStream ; 28 import java.io.PrintWriter ; 29 30 35 public class ChainedException extends Exception implements ChainedThrowable { 36 private Throwable cause; 37 38 43 public ChainedException(String msg) { 44 super(msg); 45 cause = null; 46 } 47 48 55 public ChainedException(String msg, 56 Throwable cause) { 57 super(msg); 58 this.cause = cause; 59 } 60 61 68 public ChainedException(Throwable cause) { 69 super(ChainedThrowableUtil.makeMessage(cause)); 70 this.cause = cause; 71 } 72 73 77 public String getMessage() { 78 return ChainedThrowableUtil.getMessage(this, super.getMessage()); 79 } 80 81 85 public Throwable getCause() { 86 return cause; 87 } 88 89 93 public void printStackTrace() { 94 super.printStackTrace(); 95 ChainedThrowableUtil.printCauseTrace(this); 96 } 97 98 102 public void printStackTrace(PrintStream s) { 103 super.printStackTrace(s); 104 ChainedThrowableUtil.printCauseTrace(this, s); 105 } 106 107 111 public void printStackTrace(PrintWriter s) { 112 super.printStackTrace(s); 113 ChainedThrowableUtil.printCauseTrace(this, s); 114 } 115 } 116 | Popular Tags |