All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy