| | |
| | | package com.zy.common.config; |
| | | |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.acs.common.domain.BaseResult; |
| | | import com.zy.acs.framework.exception.CoolException; |
| | | import org.springframework.web.HttpRequestMethodNotSupportedException; |
| | | import org.springframework.web.bind.annotation.ExceptionHandler; |
| | | import org.springframework.web.bind.annotation.RestControllerAdvice; |
| | |
| | | public class CoolExceptionHandler { |
| | | |
| | | @ExceptionHandler(Exception.class) |
| | | public R handlerException(HandlerMethod handler, Exception e) { |
| | | public BaseResult handlerException(HandlerMethod handler, Exception e) { |
| | | e.printStackTrace(); |
| | | return R.error(); |
| | | return BaseResult.error(); |
| | | } |
| | | |
| | | @ExceptionHandler(HttpRequestMethodNotSupportedException.class) |
| | | public R handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) { |
| | | return R.error(); |
| | | public BaseResult handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) { |
| | | return BaseResult.error(); |
| | | } |
| | | |
| | | @ExceptionHandler(CoolException.class) |
| | | public R handleRRException(CoolException e) { |
| | | return R.parse(e.getMessage()); |
| | | public BaseResult handleRRException(Exception e) { |
| | | return BaseResult.error(e.getMessage()); |
| | | } |
| | | |
| | | } |