Skip to content

Commit 0c4ff3d

Browse files
daniel-lxscte
authored andcommitted
feat: improve error messaging for stream termination errors from provider (#10548)
1 parent c00a0c7 commit 0c4ff3d

File tree

19 files changed

+38
-19
lines changed

19 files changed

+38
-19
lines changed

src/core/task/Task.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3289,9 +3289,10 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
32893289
// Determine cancellation reason
32903290
const cancelReason: ClineApiReqCancelReason = this.abort ? "user_cancelled" : "streaming_failed"
32913291

3292+
const rawErrorMessage = error.message ?? JSON.stringify(serializeError(error), null, 2)
32923293
const streamingFailedMessage = this.abort
32933294
? undefined
3294-
: (error.message ?? JSON.stringify(serializeError(error), null, 2))
3295+
: `${t("common:interruption.streamTerminatedByProvider")}: ${rawErrorMessage}`
32953296

32963297
// Clean up partial state
32973298
await abortStream(cancelReason, streamingFailedMessage)

src/i18n/locales/ca/common.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/de/common.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/en/common.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@
172172
},
173173
"interruption": {
174174
"responseInterruptedByUser": "Response interrupted by user",
175-
"responseInterruptedByApiError": "Response interrupted by API error"
175+
"responseInterruptedByApiError": "Response interrupted by API error",
176+
"streamTerminatedByProvider": "Provider ended the request"
176177
},
177178
"storage": {
178179
"prompt_custom_path": "Enter custom conversation history storage path, leave empty to use default location",

src/i18n/locales/es/common.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/fr/common.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/hi/common.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/id/common.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/it/common.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/ja/common.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)