Commit 950fe313 authored by 位宇华's avatar 位宇华

代码提交

parent f3ae73b0
......@@ -15,11 +15,17 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
@RestControllerAdvice("com.tianyi")
@Slf4j
public class GlobalExceptionHandler {
/**
* 全局异常处理
*
* @param e
* @param <T>
* @return
*/
@ExceptionHandler(RuntimeException.class)
public <T>BaseResponse<T> runtimeException(RuntimeException e) {
public <T> BaseResponse<T> runtimeException(RuntimeException e) {
log.error("RuntimeException:{}", e.getMessage(), e);
return new BaseResponse<>(ErrorCode.KEY_REPEAT.getCode(),null, e.getMessage());
return new BaseResponse<>(ErrorCode.KEY_REPEAT.getCode(), null, e.getMessage());
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment