com.nxyfan.framework.common.exception.CommonExceptionHandler Maven / Gradle / Ivy
package com.nxyfan.framework.common.exception;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import com.nxyfan.framework.common.pojo.CommonResult;
/**
* 全局异常处理器
*
* @author amour
* @date 2021/10/9 14:59
**/
@ControllerAdvice
public class CommonExceptionHandler {
/**
* 不同异常返回不同结果
*
* @author amour
* @date 2022/7/28 16:54
**/
@ResponseBody
@ExceptionHandler
public CommonResult handleException(Exception e) {
return CommonExceptionUtil.getCommonResult(e);
}
}