Commit 4042afaa authored by hanbing's avatar hanbing

[update] 增加全局异常类

parent a3877f58
......@@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.exception.FeignServiceException;
import net.wanji.common.framework.rest.JsonViewObject;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
......@@ -121,6 +122,14 @@ public class GlobalExceptionHandler {
return JsonViewObject.newInstance().fail("feign远程服务调用异常!位置在:" + errorMessage);
}
/**
* 输入值与数据类型不匹配
*/
@ExceptionHandler(value = HttpMessageNotReadableException.class)
public JsonViewObject httpMessageNotReadableExceptionHandler() {
return JsonViewObject.newInstance().fail("输入值与数据类型不匹配");
}
/**
* 处理其他异常
*/
......
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