Skip to content

Commit e74876e

Browse files
author
Justin Torre
committed
let's propagate the error back up to the user
1 parent 80ebad6 commit e74876e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

worker/src/lib/ai-gateway/AttemptExecutor.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,16 @@ export class AttemptExecutor {
140140
const response = await forwarder(endpoint.baseUrl, escrowInfo);
141141

142142
if (!response.ok) {
143+
let text: string;
144+
try {
145+
text = await response.text();
146+
} catch (error) {
147+
text = "Failed to read response body";
148+
}
149+
143150
return err({
144151
type: "request_failed",
145-
message: `Request failed with status ${response.status}`,
152+
message: `Request failed with status ${response.status}: ${text}`,
146153
statusCode: response.status,
147154
});
148155
}

0 commit comments

Comments
 (0)