We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 74680a1 commit 77b4f84Copy full SHA for 77b4f84
‎packages/inference/src/tasks/custom/streamingRequest.ts
@@ -79,7 +79,16 @@ export async function* streamingRequest<T>(
79
}
80
const data = JSON.parse(event.data);
81
if (typeof data === "object" && data !== null && "error" in data) {
82
- throw new Error(data.error);
+ const errorStr =
83
+ typeof data.error === "string"
84
+ ? data.error
85
+ : typeof data.error === "object" &&
86
+ data.error &&
87
+ "message" in data.error &&
88
+ typeof data.error.message === "string"
89
+ ? data.error.message
90
+ : JSON.stringify(data.error);
91
+ throw new Error(`Error forwarded from backend: ` + errorStr);
92
93
yield data as T;
94
0 commit comments