Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

全局拦截异常错误的提醒文字 #768

Closed
wrs645776258 opened this issue Dec 2, 2019 · 1 comment
Closed

全局拦截异常错误的提醒文字 #768

wrs645776258 opened this issue Dec 2, 2019 · 1 comment

Comments

@wrs645776258
Copy link

版本号:

2.1.2

问题描述:

全局拦截异常错误的提醒文字,其它版本一样的问题

截图&代码:

image

友情提示: 未按格式要求发帖,会直接删掉。

@wrs645776258
Copy link
Author

个人改法
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
public Result<?> HttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e){
StringBuffer sb = new StringBuffer();
sb.append("不支持");
sb.append(e.getMethod());
sb.append("请求方法,");
sb.append("支持以下");
String [] methods = e.getSupportedMethods();
if(methods!=null){
for(String str:methods){
sb.append(str);
sb.append("、");
}
}
log.error(sb.toString(), e);
/return Result.error("没有权限,请联系管理员授权");/
return Result.error(405,sb.toString());
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants