| | |
| | | package com.yuanchu.limslaboratory.handler; |
| | | |
| | | import com.yuanchu.limslaboratory.exception.ApplicationException; |
| | | import com.yuanchu.limslaboratory.exception.AuthException; |
| | | import com.yuanchu.limslaboratory.exception.MyFileException; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | | import com.yuanchu.limslaboratory.utils.ServletUtils; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.tomcat.util.http.fileupload.impl.FileSizeLimitExceededException; |
| | |
| | | log.error(String.valueOf(e)); |
| | | String message = e.getCause().getMessage(); |
| | | String[] split = message.split("'"); |
| | | String servletPath = ServletUtils.getRequest().getServletPath(); |
| | | System.out.println(servletPath); |
| | | if("/user/add_new_personnel".equals(servletPath)){ |
| | | return Result.fail("账号重复,添加失败,请核对后操作。"); |
| | | } |
| | | return Result.fail("重复添加:【" + split[1] + "】操作失败!"); |
| | | } |
| | | |
| | |
| | | return Result.fail(Integer.valueOf(e.getCode()),e.getMsg()); |
| | | } |
| | | |
| | | /** |
| | | * 业务异常 |
| | | * @param e |
| | | * @return |
| | | */ |
| | | @ExceptionHandler({ApplicationException.class }) |
| | | public Result<?> applicationError(ApplicationException e){ |
| | | return Result.fail(e.getMsg()); |
| | | } |
| | | |
| | | } |