Skip to content

Commit ade62f2

Browse files
committed
fix(xl-ai): preserve error messages in ClientSideTransport stream
The AI SDK changed toUIMessageStream()'s default onError to return a generic "An error occurred." instead of the real message (to prevent leaking server details). Since ClientSideTransport runs entirely client-side, explicitly pass onError to surface the original error.
1 parent 69f84f8 commit ade62f2

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

packages/xl-ai/src/streamTool/vercelAiSdk/clientside/ClientSideTransport.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ export class ClientSideTransport<
9595
// activeTools: ["applyDocumentOperations"],
9696
});
9797

98-
return ret.toUIMessageStream();
98+
return ret.toUIMessageStream({
99+
onError: (error) =>
100+
error instanceof Error ? error.message : String(error),
101+
});
99102
}
100103

101104
async sendMessages({

0 commit comments

Comments
 (0)