1
0
mirror of https://gitee.com/incloudcode/yexuejc-springboot.git synced 2026-03-10 06:50:05 +08:00
This commit is contained in:
2018-06-19 22:19:16 +08:00
parent 9ce8d4f216
commit accd4bbbd1
11 changed files with 51 additions and 24 deletions

View File

@@ -28,6 +28,7 @@ import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@@ -166,8 +167,11 @@ public class WebAutoConfiguration extends WebMvcConfigurerAdapter {
LogUtil.exceptionLogger.error("", e);
if (e instanceof GatewayException) {
return Resps.error(StrUtil.setStr(e.getMessage(), ERROR_MSG));
} else if (e instanceof HttpRequestMethodNotSupportedException) {
return Resps.error("请求方式错误");
}
return Resps.error(ERROR_MSG);
}
}
}