gpt4 book ai didi

com.weibo.yar.YarResponse.getError()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 18:02:31 27 4
gpt4 key购买 nike

本文整理了Java中com.weibo.yar.YarResponse.getError()方法的一些代码示例,展示了YarResponse.getError()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YarResponse.getError()方法的具体详情如下:
包路径:com.weibo.yar.YarResponse
类名称:YarResponse
方法名:getError

YarResponse.getError介绍

暂无

代码示例

代码示例来源:origin: weibocom/motan

public static Response convert(YarResponse yarResponse) {
  DefaultResponse response = new DefaultResponse();
  response.setRequestId(yarResponse.getId());
  response.setValue(yarResponse.getRet());
  if (StringUtils.isNotBlank(yarResponse.getError())) {
    response.setException(new MotanBizException(yarResponse.getError()));
  }
  return response;
}

代码示例来源:origin: com.weibo/yar-java

protected <E> E buildResponse(byte[] responseBytes, Class<E> responseClass) throws IOException {
  YarResponse yarResponse = YarProtocol.buildResponse(responseBytes);
  if (yarResponse == null || yarResponse.getError() != null) {
    throw new YarException(yarResponse == null ? "yar response is null" : yarResponse.getError());
  }
  E value = yarResponse.getValue(responseClass);
  return value;
}

代码示例来源:origin: com.weibo/yar-java

public static byte[] toProtocolBytes(YarResponse response) throws IOException {
  if (response == null) {
    throw new YarException("YarResponse is null");
  }
  Map<String, Object> responseMap = new HashMap<String, Object>();
  responseMap.put("i", response.getId());
  responseMap.put("s", response.getStatus());
  if (response.getRet() != null) {
    responseMap.put("r", response.getRet());
  }
  if (response.getOutput() != null) {
    responseMap.put("o", response.getOutput());
  }
  if (response.getError() != null) {
    responseMap.put("e", response.getError());
  }
  String packagerName = response.getPackagerName();
  return toProtocolBytes(response.getId(), packagerName, responseMap);
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com