Skip to content

Commit 518ee9b

Browse files
author
hexiaochun
committed
fix: 防止 自定义request id被覆盖
1 parent 004541f commit 518ee9b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

volcengine-java-sdk-ark-runtime/src/main/java/com/volcengine/ark/runtime/utils/ResponseBodyCallback.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,14 @@ public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response)
6868
if (line.startsWith("data:")) {
6969
String data = line.substring(5).trim();
7070

71-
ArkAPIError err = mapper.readValue(data, ArkAPIError.class);
72-
if (err.getError() != null) {
73-
throw new ArkHttpException(err, null, -1, requestId);
74-
}
71+
try {
72+
ArkAPIError err = mapper.readValue(data, ArkAPIError.class);
73+
if (err.getError() != null) {
74+
throw new ArkHttpException(err, null, -1, requestId);
75+
}
76+
} catch (ArkHttpException e) {
77+
throw e;
78+
} catch (Exception ignored) {}
7579

7680
sse = new SSE(data);
7781
} else if (line.equals("") && sse != null) {

0 commit comments

Comments
 (0)