|
@@ -19,22 +19,22 @@ public class ExceptionAdvice {
|
|
|
|
|
|
@ExceptionHandler(BaseException.class)
|
|
|
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
|
|
- public ResponseMessage handleException(Exception e){
|
|
|
- log.error("出错!", e);
|
|
|
+ public String handleException(Exception e){
|
|
|
+ log.error("访问出错:"+e.getMessage(), e);
|
|
|
if (e instanceof AccountNotExistException){
|
|
|
- return new ResponseMessage(ResponseConstant.FAIL, ResponseConstant.USER_NOT_EXISTS);
|
|
|
+ return ResponseConstant.USER_NOT_EXISTS;
|
|
|
} else if (e instanceof CrowdTestProjectNotExistException){
|
|
|
- return new ResponseMessage(ResponseConstant.FAIL, "项目不存在");
|
|
|
+ return "项目不存在";
|
|
|
} else if (e instanceof CrowdTestTaskNotExistException){
|
|
|
- return new ResponseMessage(ResponseConstant.FAIL, "任务不存在");
|
|
|
+ return "任务不存在";
|
|
|
} else if (e instanceof CrowdTestReportNotExistException){
|
|
|
- return new ResponseMessage(ResponseConstant.FAIL, "报告不存在");
|
|
|
+ return "报告不存在";
|
|
|
} else if (e instanceof CrowdTestTaskNoPriceException){
|
|
|
- return new ResponseMessage(ResponseConstant.FAIL, "项目未设置价格");
|
|
|
+ return "项目未设置价格";
|
|
|
} else if (e instanceof PasswordErrorException){
|
|
|
- return new ResponseMessage(ResponseConstant.UNAUTH, "密码错误");
|
|
|
+ return "密码错误";
|
|
|
} else
|
|
|
- return new ResponseMessage(ResponseConstant.FAIL, e.getMessage());
|
|
|
+ return e.getMessage();
|
|
|
}
|
|
|
|
|
|
@ExceptionHandler(UnauthorizedException.class)
|