| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.sql.SQLException; |
| | | import java.sql.SQLSyntaxErrorException; |
| | | |
| | | /** |
| | | * 全局异常处理类 |
| | |
| | | |
| | | @ExceptionHandler(value = ApiException.class) |
| | | public CommonResult handle(ApiException e){ |
| | | writeExceptionLogFile(e); |
| | | // writeExceptionLogFile(e); |
| | | if(e.getErrorCode()!=null){ |
| | | return CommonResult.failed(e.getErrorCode()); |
| | | } |
| | |
| | | public CommonResult handleRuntimeException(RuntimeException ex, HttpServletRequest request) |
| | | { |
| | | writeExceptionLogFile(ex); |
| | | return CommonResult.failed(ex.getMessage()); |
| | | return CommonResult.failed("内部服务异常"); |
| | | } |
| | | |
| | | |