Skip to content

Commit 452e0d2

Browse files
committed
Refactor error handling in applyChatResponse command to use a generic dictionary error message and ensure edit_format is passed when applying chat responses from edit context operations
1 parent d88a2ec commit 452e0d2

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎packages/shared/src/constants/dictionary.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ export const dictionary = {
271271
'An error occurred during refactor task. See console for details.',
272272
CONFIGURATION_ALREADY_EXISTS:
273273
'A configuration with these properties already exists.',
274-
CONFIGURATION_NOT_FOUND: 'Configuration not found.'
274+
CONFIGURATION_NOT_FOUND: 'Configuration not found.',
275+
APPLYING_CHANGES_GENERIC_ERROR: (msg: string) =>
276+
`An error occurred while applying changes: ${msg}`
275277
}
276278
}

‎packages/vscode/src/commands/apply-chat-response-command/apply-chat-response-command.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export const apply_chat_response_command = (
218218
}
219219
} catch (err: any) {
220220
vscode.window.showErrorMessage(
221-
`An error occurred while applying changes: ${err.message}`
221+
dictionary.error_message.APPLYING_CHANGES_GENERIC_ERROR(err.message)
222222
)
223223
} finally {
224224
in_progress = false

‎packages/vscode/src/views/panel/backend/message-handlers/handle-edit-context.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,8 @@ const perform_context_editing = async (params: {
423423
if (result) {
424424
vscode.commands.executeCommand('codeWebChat.applyChatResponse', {
425425
response: result.response,
426-
raw_instructions: instructions
426+
raw_instructions: instructions,
427+
edit_format
427428
})
428429
return
429430
} else {

0 commit comments

Comments
 (0)