/** * Provide a description as a {@link List} of {@link String}s of all the causes in the given {@code exception}. * * @param exception a {@link Throwable} to create a description of * @return a {@link List} of {@link String} describing the given {@link Exception} */ public static RemoteExceptionDescription describing(Throwable exception) { return new RemoteExceptionDescription(createDescription(exception, new ArrayList<>())); }
/** * Initializes the exception using the given {@code exceptionDescription} describing the remote cause-chain. * * @param exceptionDescription a {@link String} describing the remote exceptions */ public RemoteHandlingException(RemoteExceptionDescription exceptionDescription) { super("An exception was thrown by the remote message handling component: " + exceptionDescription.toString()); this.exceptionDescriptions = exceptionDescription.getDescriptions(); }
/** * Initialize a Query Handling exception from a remote source. * * @param errorCode a {@link String} defining the error code of this exception * @param message an {@link ErrorMessage} describing the exception */ public AxonServerRemoteQueryHandlingException(String errorCode, ErrorMessage message) { super(new RemoteExceptionDescription(message.getDetailsList())); this.errorCode = errorCode; this.server = message.getLocation(); }
private static List<String> createDescription(Throwable exception, List<String> descriptions) { descriptions.add(exception.getClass().getName() + DELIMITER + exception.getMessage()); Throwable cause = exception.getCause(); return cause != null ? createDescription(cause, descriptions) : descriptions; }
/** * Initializes the exception using the given {@code exceptionDescription} describing the remote cause-chain. * * @param exceptionDescription a {@link String} describing the remote exceptions */ public RemoteHandlingException(RemoteExceptionDescription exceptionDescription) { super("An exception was thrown by the remote message handling component."); this.exceptionDescriptions = exceptionDescription.getDescriptions(); }
/** * Initialize the exception with given {@code errorCode} and {@code errorMessage}. * * @param errorCode the code reported by the server * @param errorMessage the message describing the exception on the remote end */ public AxonServerRemoteCommandHandlingException(String errorCode, ErrorMessage errorMessage) { super(new RemoteExceptionDescription(errorMessage.getDetailsList())); this.errorCode = errorCode; this.server = errorMessage.getLocation(); }
private static List<String> createDescription(Throwable exception, List<String> descriptions) { descriptions.add(exception.getClass().getName() + DELIMITER + exception.getMessage()); Throwable cause = exception.getCause(); return cause != null ? createDescription(cause, descriptions) : descriptions; }
/** * Provide a description as a {@link List} of {@link String}s of all the causes in the given {@code exception}. * * @param exception a {@link Throwable} to create a description of * @return a {@link List} of {@link String} describing the given {@link Exception} */ public static RemoteExceptionDescription describing(Throwable exception) { return new RemoteExceptionDescription(createDescription(exception, new ArrayList<>())); }
/** * Initialize the exception with given {@code errorCode} and {@code errorMessage}. * * @param errorCode the code reported by the server * @param errorMessage the message describing the exception on the remote end */ public AxonServerRemoteCommandHandlingException(String errorCode, ErrorMessage errorMessage) { super(new RemoteExceptionDescription(errorMessage.getDetailsList())); this.errorCode = errorCode; this.server = errorMessage.getLocation(); }
/** * Initialize a Query Handling exception from a remote source. * * @param errorCode a {@link String} defining the error code of this exception * @param message an {@link ErrorMessage} describing the exception */ public AxonServerRemoteQueryHandlingException(String errorCode, ErrorMessage message) { super(new RemoteExceptionDescription(message.getDetailsList())); this.errorCode = errorCode; this.server = message.getLocation(); }