DecoratorChainException.java

  1. /*
  2.  * @copyright defined in LICENSE.txt
  3.  */

  4. package hera.exception;

  5. import hera.api.function.FunctionDecorator;

  6. /**
  7.  * An error to keep exception in a decorator chain of {@link FunctionDecorator}.
  8.  */
  9. public class DecoratorChainException extends HerajException {

  10.   private static final long serialVersionUID = 8413911651198429198L;

  11.   /**
  12.    * DecoratorChainException constructor.
  13.    *
  14.    * @param cause a cause of decorator chain. It its {@link DecoratorChainException}, keep cause of
  15.    *        it.
  16.    */
  17.   public DecoratorChainException(final Throwable cause) {
  18.     super((cause instanceof DecoratorChainException) ? cause.getCause() : cause);
  19.   }

  20.   /**
  21.    * DecoratorChainException constructor.
  22.    *
  23.    * @param message a message
  24.    * @param cause a cause of decorator chain. It its {@link DecoratorChainException}, keep cause of
  25.    *        it.
  26.    */
  27.   public DecoratorChainException(final String message, final Throwable cause) {
  28.     super(message, (cause instanceof DecoratorChainException) ? cause.getCause() : cause);
  29.   }

  30. }