56 lines
1.8 KiB
Java
56 lines
1.8 KiB
Java
//package com.guwan.backend.face.rpc;
|
|
//
|
|
//
|
|
//import com.guwan.backend.face.enums.ErrorCodeEnum;
|
|
//import lombok.extern.slf4j.Slf4j;
|
|
//import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
//import org.springframework.web.bind.annotation.RestControllerAdvice;
|
|
//
|
|
//@RestControllerAdvice
|
|
//@Slf4j
|
|
//public class GlobalExceptionHandler{
|
|
//
|
|
//
|
|
// /**
|
|
// * 自定义异常
|
|
// */
|
|
// @ExceptionHandler(BusinessException.class)
|
|
// public Response businessException(BusinessException e) {
|
|
// log.error(e.getMessage(), e);
|
|
// Response response = new Response();
|
|
// response.setCode(e.getErrorCode().getCode());
|
|
// response.setMsg(e.getMsgCN());
|
|
// return response;
|
|
// }
|
|
//
|
|
// @ExceptionHandler(IllegalArgumentException.class)
|
|
// public Response handleIllegalArgumentException(IllegalArgumentException e) {
|
|
// log.error(e.getMessage(), e);
|
|
// Response response = new Response();
|
|
// response.setCode(ErrorCodeEnum.PARAM_ERROR.getCode());
|
|
// response.setMsg(e.getMessage());
|
|
// return response;
|
|
// }
|
|
//
|
|
// @ExceptionHandler(Exception.class)
|
|
// public Response handleException(Exception e) {
|
|
// log.error(e.getMessage(), e);
|
|
// Response response = new Response();
|
|
// response.setCode(ErrorCodeEnum.SYSTEM_ERROR.getCode());
|
|
// response.setMsg(ErrorCodeEnum.SYSTEM_ERROR.getDescCN());
|
|
// return response;
|
|
// }
|
|
//
|
|
//
|
|
//
|
|
//// @ExceptionHandler(InternalServerErrorException.class)
|
|
//// @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
|
//// public ResponseEntity<String> handleInternalServerErrorException(InternalServerErrorException ex) {
|
|
//// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(ex.getMessage());
|
|
//// }
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//}
|