GlobalExceptionHandler.java 662 Bytes
package com.viontech.fanxing.commons.base;

import com.viontech.keliu.util.JsonMessageUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * .
 *
 * @author 谢明辉
 * @date 2020/6/4
 */
@RestControllerAdvice
public class GlobalExceptionHandler {
    private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);

    @ExceptionHandler
    public Object exceptionHandler(Exception e) {
        log.info("", e);
        return JsonMessageUtil.getErrorJsonMsg(e.getMessage());
    }
}