|
|
|
@ -8,7 +8,6 @@ import com.supervision.exception.BusinessException;
|
|
|
|
|
import com.supervision.exception.HumanException;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.core.MethodParameter;
|
|
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
|
import org.springframework.http.MediaType;
|
|
|
|
|
import org.springframework.http.converter.HttpMessageConverter;
|
|
|
|
@ -72,7 +71,9 @@ public class ResponseConfig implements ResponseBodyAdvice<Object> {
|
|
|
|
|
@ExceptionHandler(BusinessException.class)
|
|
|
|
|
public GlobalResult<?> businessExceptionResponse(BusinessException exception) {
|
|
|
|
|
log.error(exception.getMessage(), exception);
|
|
|
|
|
return GlobalResult.error(HttpStatus.INTERNAL_SERVER_ERROR.value(), exception.getMessage(), "业务异常");
|
|
|
|
|
Integer code = null == exception.getCode() ? HttpStatus.INTERNAL_SERVER_ERROR.value(): exception.getCode();
|
|
|
|
|
String message = StrUtil.isNotEmpty(exception.getMessage()) ? exception.getMessage() : "业务异常";
|
|
|
|
|
return GlobalResult.error( code, exception.getMessage(), message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|