Skip to content

Commit 5e9eb32

Browse files
committed
Handle preview finished errors gracefully during patch repair
- cancel_all_patch_repairs causes re-appearing configurations selector ├── apps │ └── editor │ └── src │ ├── commands │ │ └── apply-response-command │ │ └── utils │ │ └── preview │ │ ├── preview.ts │ │ └── vscode-ui.ts │ ├── extension.ts │ └── views │ └── prompt │ ├── backend │ │ ├── message-handlers │ │ │ ├── handle-patch-repair.ts │ │ │ ├── handle-response-preview.ts │ │ │ └── utils │ │ │ └── patch-repair-utils.ts │ │ └── prompt-view-provider.ts │ ├── frontend │ │ ├── Prompt.tsx │ │ └── hooks │ │ └── use-preview-manager.ts │ └── types │ └── messages.ts └── packages └── ui └── src └── components └── editor └── prompt ├── ResponsePreview │ ├── ResponsePreview.tsx │ └── components │ └── FileItem │ └── FileItem.tsx └── ResponsePreviewFooter └── ResponsePreviewFooter.tsx
1 parent bc49e8a commit 5e9eb32

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

‎apps/editor/src/views/prompt/backend/message-handlers/handle-patch-repair.ts‎

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,8 @@ export const handle_patch_repair = async (params: {
474474
!axios.isCancel(error) &&
475475
error.message != 'User cancelled the operation' &&
476476
error.message !=
477-
'Batch operation failed, triggering configuration selection.'
477+
'Batch operation failed, triggering configuration selection.' &&
478+
error.message != 'Preview finished.'
478479
) {
479480
Logger.error({
480481
function_name: 'handle_patch_repair',
@@ -489,11 +490,16 @@ export const handle_patch_repair = async (params: {
489490
)
490491
}
491492

492-
batch_abort_controllers.forEach((controller) => {
493-
controller.abort(
494-
'Batch operation failed, triggering configuration selection.'
495-
)
496-
})
493+
if (
494+
error.message != 'Preview finished.' &&
495+
error.message != 'User cancelled the operation'
496+
) {
497+
batch_abort_controllers.forEach((controller) => {
498+
controller.abort(
499+
'Batch operation failed, triggering configuration selection.'
500+
)
501+
})
502+
}
497503

498504
throw error
499505
} finally {
@@ -518,6 +524,13 @@ export const handle_patch_repair = async (params: {
518524
})
519525
)
520526
} catch (error: any) {
527+
if (
528+
error.message == 'Preview finished.' ||
529+
error.message == 'User cancelled the operation'
530+
) {
531+
return
532+
}
533+
521534
const remaining_files = params.files_to_fix.filter((f) => {
522535
const key = f.workspace_name
523536
? `${f.workspace_name}:${f.file_path}`

0 commit comments

Comments
 (0)