Class AgentProtocolException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
nl.pim16aap2.lightkeeper.protocol.AgentProtocolException
All Implemented Interfaces:
Serializable

public final class AgentProtocolException extends RuntimeException
Thrown by agent request handlers to signal a structured protocol-level failure.

The dispatcher catches this exception and serializes it as an error response using AgentErrorCode.wireCode() rather than the generic REQUEST_FAILED code.

Example:


 throw new AgentProtocolException(AgentErrorCode.AUTH_FAILED, "Auth token mismatch.");
 
See Also:
  • Constructor Details

    • AgentProtocolException

      public AgentProtocolException(AgentErrorCode errorCode, String message)
      Parameters:
      errorCode - Stable machine-readable error code for this failure.
      message - Human-readable failure detail.
    • AgentProtocolException

      public AgentProtocolException(AgentErrorCode errorCode, String message, Throwable cause)
      Parameters:
      errorCode - Stable machine-readable error code for this failure.
      message - Human-readable failure detail.
      cause - Underlying exception that triggered this failure.
  • Method Details

    • errorCode

      public AgentErrorCode errorCode()
      Returns the error code that the dispatcher should include in the wire response.
      Returns:
      Non-null error code.