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<>())); }
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<>())); }