FdkkMiniReqErrorCallback.java 870 B

123456789101112131415161718192021222324252627282930
  1. package com.fdkankan.scene.callback;
  2. import com.dtflys.forest.callback.OnError;
  3. import com.dtflys.forest.callback.OnSuccess;
  4. import com.dtflys.forest.exceptions.ForestRuntimeException;
  5. import com.dtflys.forest.http.ForestRequest;
  6. import com.dtflys.forest.http.ForestResponse;
  7. import com.fdkankan.common.constant.ServerCode;
  8. import com.fdkankan.common.exception.BusinessException;
  9. import lombok.extern.slf4j.Slf4j;
  10. import org.springframework.stereotype.Component;
  11. /**
  12. * <p>
  13. * TODO
  14. * </p>
  15. *
  16. * @author dengsixing
  17. * @since 2022/4/25
  18. **/
  19. @Slf4j
  20. public class FdkkMiniReqErrorCallback implements OnError {
  21. @Override
  22. public void onError(ForestRuntimeException e, ForestRequest forestRequest,
  23. ForestResponse forestResponse) {
  24. log.error("跨服务请求失败!", e);
  25. throw new BusinessException(ServerCode.FEIGN_REQUEST_FAILD);
  26. }
  27. }