@ExceptionHandler(Throwable.class)
  @ResponseBody
  @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
  public String handleException(final Throwable cause) {
    final StringWriter stackTraceWriter = new StringWriter();
    cause.printStackTrace(new PrintWriter(stackTraceWriter));
    final String stackTrace = stackTraceWriter.toString();

    if (logger.isDebugEnabled()) {
      logger.debug(stackTrace);
    }

    return convertErrorAsJson(cause.getMessage());
  }
Handles any Exception thrown by a REST API web service endpoint, HTTP request handler method.
<p>

@param cause the Exception causing the error.
@return a ResponseEntity with an appropriate HTTP status code (500 - Internal Server Error) and
        HTTP response body containing the stack trace of the Exception.
geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/BaseControllerAdvice.java