Update app/client/platforms/bedrock.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
glay
2024-12-09 10:03:06 +08:00
committed by GitHub
parent a0886875e1
commit 44a1cf6d6e

View File

@@ -826,21 +826,26 @@ function bedrockStream(
index = result.index;
}
} catch (err) {
console.error("[Bedrock Stream Error]:", err);
throw err;
console.error(
"[Bedrock Stream]:",
err instanceof Error ? err.message : "Stream processing failed"
);
throw new Error("Failed to process stream response");
} finally {
reader.releaseLock();
finish();
}
} catch (e) {
// @ts-ignore
if (e.name === "AbortError") {
if (e instanceof Error && e.name === "AbortError") {
console.log("[Bedrock Client] Aborted by user");
return;
}
console.error("[Bedrock Request] error", e);
console.error(
"[Bedrock Request] Failed:",
e instanceof Error ? e.message : "Request failed"
);
options.onError?.(e);
throw e;
throw new Error("Request processing failed");
}
}