Skip to content

Commit 4193fc3

Browse files
saphidclaude
andcommitted
fix(cursor): failed Cursor text generation shows Cursor's reason
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 5b9731c commit 4193fc3

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

‎packages/provider-cursor/src/server/textGeneration.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ describe("CursorTextGeneration", () => {
202202
id: "run-cursor-partial-title-test",
203203
status,
204204
result: '{"title":"Partial title from a failed run."}',
205+
...(status === "error" ? { error: { message: "Usage limit reached." } } : {}),
205206
} satisfies RunResult;
206207
cursorSdkMock.prompt.mockResolvedValueOnce(promptResult);
207208
const generation = yield* makeCursorTextGeneration(cursorSettings, {
@@ -222,7 +223,7 @@ describe("CursorTextGeneration", () => {
222223
expect(failure.detail).toBe(
223224
status === "cancelled"
224225
? "Cursor SDK request was cancelled."
225-
: "Cursor SDK request finished with an error.",
226+
: "Cursor SDK request finished with an error: Usage limit reached.",
226227
);
227228
expect(cursorSdkMock.close).toHaveBeenCalledOnce();
228229
}).pipe(Effect.provide(layerTest)),

‎packages/provider-cursor/src/server/textGeneration.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ function cursorSdkResultDetail(result: RunResult): string {
2222
switch (result.status) {
2323
case "cancelled":
2424
return "Cursor SDK request was cancelled.";
25-
case "error":
26-
return "Cursor SDK request finished with an error.";
25+
case "error": {
26+
const message = result.error?.message.trim();
27+
return message
28+
? `Cursor SDK request finished with an error: ${message}`
29+
: "Cursor SDK request finished with an error.";
30+
}
2731
case "finished":
2832
return "Cursor SDK returned empty output.";
2933
}

0 commit comments

Comments
 (0)