Class ExceptionConverter

java.lang.Object
org.axonframework.axonserver.connector.util.ExceptionConverter

public final class ExceptionConverter extends Object
Utility class used to serializer Throwables into ErrorMessages.
Since:
4.0
Author:
Marc Gathier
  • Method Details

    • convertToAxonException

      public static AxonException convertToAxonException(String errorCode, io.axoniq.axonserver.grpc.ErrorMessage errorMessage, io.axoniq.axonserver.grpc.SerializedObject payload)
      Converts the given error information into an AxonException.
      Parameters:
      errorCode - The error code identifying the type of exception to convert to.
      errorMessage - The ErrorMessage containing details of the error.
      payload - An optional SerializedObject representing additional error data, which may be used in the exception conversion.
      Returns:
      An instance of AxonException representing the given error information.
    • convertToErrorMessage

      public static io.axoniq.axonserver.grpc.ErrorMessage convertToErrorMessage(String clientLocation, @Nullable ErrorCode errorCode, Throwable t)
      Serializes a given Throwable into an ErrorMessage.
      Parameters:
      clientLocation - the name of the client were the ErrorMessage originates from
      errorCode - The error code identifying the type of action that resulted in an error, if known
      t - the Throwable to base this ErrorMessage on
      Returns:
      the ErrorMessage originating from the given clientLocation and based on the Throwable