Class ExceptionConverter
java.lang.Object
org.axonframework.axonserver.connector.util.ExceptionConverter
Utility class used to serializer
Throwables into ErrorMessages.- Since:
- 4.0
- Author:
- Marc Gathier
-
Method Summary
Modifier and TypeMethodDescriptionstatic AxonExceptionconvertToAxonException(String errorCode, io.axoniq.axonserver.grpc.ErrorMessage errorMessage, io.axoniq.axonserver.grpc.SerializedObject payload) Converts the given error information into anAxonException.static io.axoniq.axonserver.grpc.ErrorMessageconvertToErrorMessage(String clientLocation, ErrorCode errorCode, Throwable t) Serializes a givenThrowableinto anErrorMessage.
-
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 anAxonException.- Parameters:
errorCode- The error code identifying the type of exception to convert to.errorMessage- TheErrorMessagecontaining details of the error.payload- An optionalSerializedObjectrepresenting additional error data, which may be used in the exception conversion.- Returns:
- An instance of
AxonExceptionrepresenting the given error information.
-
convertToErrorMessage
public static io.axoniq.axonserver.grpc.ErrorMessage convertToErrorMessage(String clientLocation, @Nullable ErrorCode errorCode, Throwable t) Serializes a givenThrowableinto anErrorMessage.- Parameters:
clientLocation- the name of the client were theErrorMessageoriginates fromerrorCode- The error code identifying the type of action that resulted in an error, if knownt- theThrowableto base thisErrorMessageon- Returns:
- the
ErrorMessageoriginating from the givenclientLocationand based on theThrowable
-