Class HekateException

    • Constructor Detail

      • HekateException

        public HekateException​(String message)
        Constructs a new instance.
        Parameters:
        message - Error message.
      • HekateException

        public HekateException​(String message,
                               Throwable cause)
        Constructs a new instance.
        Parameters:
        message - Error message.
        cause - Cause.
      • HekateException

        protected HekateException​(String message,
                                  Throwable cause,
                                  boolean enableSuppression,
                                  boolean writableStackTrace)
        Constructs a new instance.
        Parameters:
        message - Error message.
        cause - Cause.
        enableSuppression - Enabled/disabled suppression.
        writableStackTrace - Whether or not the stack trace should be writable.
    • Method Detail

      • forkFromAsync

        public HekateException forkFromAsync()
        Forks this exception by creating a new exception that has this instance as its cause.

        The primary use case of this method is to re-throw exceptions from asynchronous contexts (f.e. exceptions thrown by Future.get() method).

        Returns:
        Fork of this exception.
      • isCausedBy

        public boolean isCausedBy​(Class<? extends Throwable> causeType)
        Returns true if this exception is caused by an error of the specified type.
        Parameters:
        causeType - Error type.
        Returns:
        true if this exception is caused by an error of the specified type.
      • findCause

        public <T extends Throwable> T findCause​(Class<T> type)
        Searches for an error cause of the specified type. Returns null if there is no such error.
        Type Parameters:
        T - Error type.
        Parameters:
        type - Error type.
        Returns:
        Error or null.