GlobalExceptionHandler.java 614 Bytes
package com.taover.ai.advice;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taover.util.UtilLog;
import com.taover.util.bean.ResultInfo;
import com.taover.util.bean.UtilResultInfo;

@ControllerAdvice
public class GlobalExceptionHandler {		
	@ExceptionHandler(value = Exception.class)
	@ResponseBody
	public ResultInfo handlerException(Exception e) {
		UtilLog.errorForException(e, this.getClass());	
		return UtilResultInfo.getFailure(e.getMessage());
	}
}