Package io.hekate.core
Class HekateException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- io.hekate.core.HekateException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ClusterException
,HekateExecutionException
,HekateInterruptedException
,HekateIoException
,HekateTimeoutException
,JmxServiceException
,LeaderException
,MessagingException
,RejectedResponseException
,ResourceLoadException
,RpcException
public class HekateException extends RuntimeException
Generic base class for Hekate errors.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description HekateException(String message)
Constructs a new instance.HekateException(String message, Throwable cause)
Constructs a new instance.protected
HekateException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace)
Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Throwable>
TfindCause(Class<T> type)
Searches for an error cause of the specified type.HekateException
forkFromAsync()
Forks this exception by creating a new exception that has this instance as its cause.boolean
isCausedBy(Class<? extends Throwable> causeType)
Returnstrue
if this exception is caused by an error of the specified type.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
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)
Returnstrue
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.
-
-