1 17 18 package org.sape.carbon.core.exception; 19 20 21 import org.sape.carbon.core.util.classify.SeverityEnum; 22 23 40 public abstract class BaseException extends Exception implements Exceptionable { 41 42 43 47 protected ExceptionDelegate delegatedException; 48 49 55 public BaseException(Class sourceClass, String message) { 56 57 super(message); 58 this.delegatedException = 59 ExceptionDelegateFactory.getInstance().createDelegate( 60 sourceClass, this.getSeverity(), this, message, null); 61 this.delegatedException.handleException(); 62 } 63 64 73 public BaseException(Class sourceClass, String message, 74 Throwable cause) { 75 76 super(message); 77 78 this.delegatedException = 79 ExceptionDelegateFactory.getInstance().createDelegate( 80 sourceClass, this.getSeverity(), this, message, cause); 81 this.delegatedException.handleException(); 82 } 83 84 85 86 91 public abstract SeverityEnum getSeverity(); 92 93 94 100 public Class getExceptionSource() { 101 return this.delegatedException.getExceptionSource(); 102 } 103 104 105 109 public Throwable getCause() { 110 return this.delegatedException.getCause(); 111 } 112 113 114 118 public String toString() { 119 return this.delegatedException.toString(); 120 } 121 122 123 127 public String getMessage() { 128 return this.delegatedException.getMessage(); 129 } 130 131 136 137 138 } | Popular Tags |