+ /**
+ * Logs the error and generates a response when a REST controller method takes
+ * an StatsManagerException.
+ *
+ * @param ex
+ * The exception
+ * @param request
+ * The original request
+ * @return A response entity with status code 400 and an unstructured message.
+ */
+ @ExceptionHandler({ StatsManagerException.class })
+ public final ResponseEntity<String> handleStatsManagerException(Exception ex, WebRequest request) {
+ log.warn("handleStatsManagerException: request {}, exception {}", request.getDescription(false), ex.toString());
+ return ResponseEntity.badRequest().body(getShortExceptionMessage(ex));
+ }
+