fixed: handler 可能为非HandlerMethod 类型的异常
This commit is contained in:
parent
74055a5390
commit
19708ebeb6
|
@ -34,11 +34,13 @@ public class WebExceptionResolver implements HandlerExceptionResolver {
|
||||||
|
|
||||||
// if json
|
// if json
|
||||||
boolean isJson = false;
|
boolean isJson = false;
|
||||||
|
if (handler instanceof HandlerMethod) {
|
||||||
HandlerMethod method = (HandlerMethod)handler;
|
HandlerMethod method = (HandlerMethod)handler;
|
||||||
ResponseBody responseBody = method.getMethodAnnotation(ResponseBody.class);
|
ResponseBody responseBody = method.getMethodAnnotation(ResponseBody.class);
|
||||||
if (responseBody != null) {
|
if (responseBody != null) {
|
||||||
isJson = true;
|
isJson = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// error result
|
// error result
|
||||||
ReturnT<String> errorResult = new ReturnT<String>(ReturnT.FAIL_CODE, ex.toString().replaceAll("\n", "<br/>"));
|
ReturnT<String> errorResult = new ReturnT<String>(ReturnT.FAIL_CODE, ex.toString().replaceAll("\n", "<br/>"));
|
||||||
|
|
Loading…
Reference in New Issue