code: public RestFailure renderFailure(Throwable e)
  	{
  		// Strip away ApplicationException wrappers
  		if (e.getCause() != null && (e instanceof ApplicationException))
  		{
  			return renderFailure(e.getCause());
  		}
  		RestFailure failure = new RestFailure();
  
  		failure.id = getOrGenerateFailureId();
  		failure.date = new Date();
  
  		if (e instanceof RestException)
  		{
  			RestException re = (RestException) e;
  			failure.httpCode = re.getHttpCode();
  			failure.exception = renderThrowable(e);
  		}
  		else
  		{
  			failure.httpCode = 500; // by default
  			failure.exception = renderThrowable(e);
  		}
  		return failure;
  	}
docs: Render a Throwable as a RestFailure
  
  @param e
  
  @return