diff --git a/src/main/java/teetime/framework/StageException.java b/src/main/java/teetime/framework/StageException.java index c1a6a8da63da74e00cc1524f1e058ca599116b0b..3f6c2b25989e219b64588f4e83202c845baee6fc 100644 --- a/src/main/java/teetime/framework/StageException.java +++ b/src/main/java/teetime/framework/StageException.java @@ -12,12 +12,18 @@ public class StageException extends Exception { private static final long serialVersionUID = 6724637605943897808L; private final Stage throwingStage; + private final Exception originalException; - public StageException(final Stage throwingStage) { + public StageException(final Exception e, final Stage throwingStage) { super(); + this.originalException = e; this.throwingStage = throwingStage; } + public Exception getOriginalException() { + return originalException; + } + /** * Returns the stage, which failed with an uncatched exception * diff --git a/src/main/java/teetime/framework/StageExceptionListener.java b/src/main/java/teetime/framework/StageExceptionListener.java index 7f149c166bea31b70e0b215a82d63ddaab0537ed..5d43088de5b31c23422a04c36da73e9ebc0ef02f 100644 --- a/src/main/java/teetime/framework/StageExceptionListener.java +++ b/src/main/java/teetime/framework/StageExceptionListener.java @@ -1,5 +1,9 @@ package teetime.framework; +/** + * Represent a minimalistic StageExceptionListener. Listener which extend from this one, must a least implement this functionality. + * + */ public abstract class StageExceptionListener { private final Thread thread; @@ -8,6 +12,23 @@ public abstract class StageExceptionListener { this.thread = thread; } - public abstract void onStageException(Stage throwingStage); + /** + * This method will be executed if an exception arises. + * + * @param e + * thrown exception + * @param throwingStage + * the stage, which has thrown the exception. + */ + public abstract void onStageException(Exception e, Stage throwingStage); + + /** + * Retrieves the thread in which the exception occurred. + * + * @return exception throwing thread + */ + public Thread getThread() { + return thread; + } }