全局错误处理
This commit is contained in:
parent
a1ba010375
commit
6a5c6a2d38
|
@ -24,8 +24,7 @@ public class RestControllerExceptionHandler {
|
|||
|
||||
@ExceptionHandler(MSException.class)
|
||||
public ResultHolder msExceptionHandler(HttpServletRequest request, HttpServletResponse response, MSException e) {
|
||||
// 自定义异常返回200
|
||||
response.setStatus(HttpStatus.OK.value());
|
||||
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||
return ResultHolder.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,11 @@ export default {
|
|||
function exception(error, result) {
|
||||
result.loading = false;
|
||||
window.console.error(error.response || error.message);
|
||||
Message.error({message: error.message, showClose: true});
|
||||
if (error.response.data) {
|
||||
Message.error({message: error.response.data.message, showClose: true});
|
||||
} else {
|
||||
Message.error({message: error.message, showClose: true});
|
||||
}
|
||||
}
|
||||
|
||||
Vue.prototype.$get = function (url, success) {
|
||||
|
|
Loading…
Reference in New Issue