001 package org.bukkit.event;
002
003 public class EventException extends Exception {
004 private static final long serialVersionUID = 3532808232324183999L;
005 private final Throwable cause;
006
007 /**
008 * Constructs a new EventException based on the given Exception
009 *
010 * @param throwable Exception that triggered this Exception
011 */
012 public EventException(Throwable throwable) {
013 cause = throwable;
014 }
015
016 /**
017 * Constructs a new EventException
018 */
019 public EventException() {
020 cause = null;
021 }
022
023 /**
024 * Constructs a new EventException with the given message
025 *
026 * @param cause The exception that caused this
027 * @param message The message
028 */
029 public EventException(Throwable cause, String message) {
030 super(message);
031 this.cause = cause;
032 }
033
034 /**
035 * Constructs a new EventException with the given message
036 *
037 * @param message The message
038 */
039 public EventException(String message) {
040 super(message);
041 cause = null;
042 }
043
044 /**
045 * If applicable, returns the Exception that triggered this Exception
046 *
047 * @return Inner exception, or null if one does not exist
048 */
049 @Override
050 public Throwable getCause() {
051 return cause;
052 }
053 }