|
@@ -0,0 +1,21 @@
|
|
|
+package com.tzld.piaoquan.recommend.server.web;
|
|
|
+
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.web.bind.annotation.ControllerAdvice;
|
|
|
+import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+
|
|
|
+@ControllerAdvice
|
|
|
+@Slf4j
|
|
|
+public class GlobalExceptionHandler {
|
|
|
+
|
|
|
+ @ExceptionHandler
|
|
|
+ @ResponseBody
|
|
|
+ public String handleException(HttpServletRequest hsr, Exception e) {
|
|
|
+ log.error("request uri {} error", hsr.getRequestURI(), e);
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+}
|