增加分区

This commit is contained in:
许晓东
2021-10-19 14:40:17 +08:00
parent 0f4663d58f
commit 83c8217d73
6 changed files with 77 additions and 28 deletions

View File

@@ -0,0 +1,27 @@
package com.xuxd.kafka.console.interceptor;
import com.xuxd.kafka.console.beans.ResponseData;
import javax.servlet.http.HttpServletRequest;
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;
/**
* kafka-console-ui.
*
* @author xuxd
* @date 2021-10-19 14:32:18
**/
@Slf4j
@ControllerAdvice(basePackages = "com.xuxd.kafka.console.controller")
public class GlobalExceptionHandler {
@ExceptionHandler(value = Exception.class)
@ResponseBody
public Object exceptionHandler(HttpServletRequest req, Exception ex) throws Exception {
log.error("exception handle: ", ex);
return ResponseData.create().failed(ex.getMessage());
}
}