Class MiddlewareException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ConsensusException, CoordinationException, DurableLogException, IsolationException, MessagingException, RepositoryReplicationException, SagaException

public class MiddlewareException extends RuntimeException
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 Details

    • MiddlewareException

      public MiddlewareException(RemoteError remoteError)
      Creates an exception from a normalized remote error.
      Parameters:
      remoteError - normalized error payload
    • MiddlewareException

      public MiddlewareException(RemoteError remoteError, Throwable cause)
      Creates an exception from a normalized remote error and root cause.
      Parameters:
      remoteError - normalized error payload
      cause - implementation exception that caused the failure
  • Method Details

    • of

      public static MiddlewareException of(MiddlewareErrorCode code, String message)
      Creates a simple exception with no transport metadata.
      Parameters:
      code - stable error code
      message - 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 code
      message - safe message
      invocationId - invocation identifier
      remoteRuntimeId - remote runtime identifier
      retryable - retry hint
      dirtyTarget - target health hint
      Returns:
      new middleware exception
    • remoteError

      public RemoteError remoteError()
      Returns the normalized error payload.
      Returns:
      immutable error payload
    • code

      public MiddlewareErrorCode code()
      Returns the stable error code.
      Returns:
      error 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