private void processException(Throwable e) { if (e instanceof ServerException) { System.err.println("ServerException: code='" + ((ServerException) e).getCode() + "', class='" + e.getClass().getName() + "'"); StackTraceElement[] traces = e.getStackTrace(); for (StackTraceElement element : traces) { System.err.println(element); } Throwable cause = e.getCause(); if (cause != null) { cause.printStackTrace(); } fail("Threw a ServerException"); } else { e.printStackTrace(); fail("Threw an exception"); } }