class ErrorResponses {

    static List<StackTraceRepresentation> buildExceptionContext(Throwable cause) {
        List<StackTraceRepresentation> stackTraces = new ArrayList<>();

        for (Throwable currentCause = cause; currentCause != null; currentCause = currentCause.getCause()) {
            stackTraces.add(new StackTraceRepresentation(currentCause));
        }
        return stackTraces;
    }

    private  ErrorResponses();

}