String (@NotNull Throwable exception) { Throwable rootCauseException = exception; while (rootCauseException.getCause() != null) { rootCauseException = rootCauseException.getCause(); } String message = rootCauseException.getMessage(); if (message == null) { message = exception.getMessage(); } if (message == null) { message = exception.getClass().getName(); } return message; }