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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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