protected ResourceException error(Status status, Throwable cause) { StringWriter sw = new StringWriter(); cause.printStackTrace(new PrintWriter(sw)); String st = sw.toString(); getResponse() .setEntity( "Exception Thrown: " + cause.getMessage() + " Stacktrace: " + st, MediaType.TEXT_PLAIN); return new ResourceException(status, cause); }
protected ResourceException error(Status status, String message, Throwable cause) { StringWriter sw = new StringWriter(); cause.printStackTrace(new PrintWriter(sw)); String st = sw.toString(); getResponse().setEntity(message + " Stacktrace: " + st, MediaType.TEXT_PLAIN); // TODO: Remove // DEBUGGING CODE for CURRIKI-4238 System.out.println("ERROR THROWN: " + message + " Stacktrace: " + st); cause.printStackTrace(); return new ResourceException( Status.CLIENT_ERROR_NOT_ACCEPTABLE, message + " Stacktrace: " + st, cause); }