Class MiddlewareException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.j7m.middleware.api.MiddlewareException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ConsensusException, CoordinationException, DurableLogException, IsolationException, MessagingException, RepositoryReplicationException, SagaException
Base unchecked exception for all public middleware failures.
The exception is immutable after construction and safe to share across threads. Low-level exceptions are available only as causes and should not be inspected by portable callers.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMiddlewareException(RemoteError remoteError) Creates an exception from a normalized remote error.MiddlewareException(RemoteError remoteError, Throwable cause) Creates an exception from a normalized remote error and root cause. -
Method Summary
Modifier and TypeMethodDescriptioncode()Returns the stable error code.booleanReturns whether the current target should be replaced before retry.static MiddlewareExceptionof(MiddlewareErrorCode code, String message) Creates a simple exception with no transport metadata.static MiddlewareExceptionremote(MiddlewareErrorCode code, String message, String invocationId, String remoteRuntimeId, boolean retryable, boolean dirtyTarget) Creates a simple exception with transport metadata.Returns the normalized error payload.booleanReturns whether retrying the operation may succeed.Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
MiddlewareException
Creates an exception from a normalized remote error.- Parameters:
remoteError- normalized error payload
-
MiddlewareException
Creates an exception from a normalized remote error and root cause.- Parameters:
remoteError- normalized error payloadcause- implementation exception that caused the failure
-
-
Method Details
-
of
Creates a simple exception with no transport metadata.- Parameters:
code- stable error codemessage- safe message- Returns:
- new middleware exception
-
remote
public static MiddlewareException remote(MiddlewareErrorCode code, String message, String invocationId, String remoteRuntimeId, boolean retryable, boolean dirtyTarget) Creates a simple exception with transport metadata.- Parameters:
code- stable error codemessage- safe messageinvocationId- invocation identifierremoteRuntimeId- remote runtime identifierretryable- retry hintdirtyTarget- target health hint- Returns:
- new middleware exception
-
remoteError
Returns the normalized error payload.- Returns:
- immutable error payload
-
code
-
retryable
public boolean retryable()Returns whether retrying the operation may succeed.- Returns:
- retryable flag
-
dirtyTarget
public boolean dirtyTarget()Returns whether the current target should be replaced before retry.- Returns:
- dirty-target flag
-