Skip to content

Conversation

@benfdking
Copy link
Contributor

No description provided.

@benfdking benfdking requested a review from Copilot June 6, 2025 11:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR centralises error handling by introducing a single handleError entrypoint and refactors calling code to use it instead of duplicated switch statements.

  • Adds handleError in errors.ts and converts per-case handlers to internal functions.
  • Refactors LSP activation/restart and format command to call handleError.
  • Removes repetitive switch blocks and cleans up imports.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
vscode/extension/src/utilities/errors.ts Added handleError, made existing handlers internal, and added JSDoc for new interface
vscode/extension/src/extension.ts Replaced inline switch on lspClient errors with handleError calls
vscode/extension/src/commands/format.ts Updated format command to import and use handleError instead of switches
Comments suppressed due to low confidence (2)

vscode/extension/src/utilities/errors.ts:75

  • Correct the typo in the log message to match the function name: change 'handleNotSginedInError' to 'handleNotSignedInError'.
traceInfo('handleNotSginedInError')

vscode/extension/src/utilities/errors.ts:29

  • Add unit tests for the new handleError function to cover each error type branch, including cases with and without genericErrorPrefix, to ensure centralised error handling behaves correctly.
export async function handleError(

@benfdking benfdking merged commit 53224fc into main Jun 6, 2025
25 checks passed
@benfdking benfdking deleted the refactor_error_handling branch June 6, 2025 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants