Skip to content

Commit a9c521a

Browse files
Copilotalexr00
andcommitted
Refactor: Use consistent error handling in both toggleReaction implementations
- Import formatError in pullRequestCommentController.ts - Use formatError(e) consistently in both implementations - Throw new Error(errorMessage) consistently instead of rethrowing original error Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent d2b35ef commit a9c521a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/view/pullRequestCommentController.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { disposeAll } from '../common/lifecycle';
1212
import Logger from '../common/logger';
1313
import { ITelemetry } from '../common/telemetry';
1414
import { fromPRUri, Schemes } from '../common/uri';
15-
import { groupBy } from '../common/utils';
15+
import { formatError, groupBy } from '../common/utils';
1616
import { PULL_REQUEST_OVERVIEW_VIEW_TYPE } from '../common/webview';
1717
import { FolderRepositoryManager } from '../github/folderRepositoryManager';
1818
import { GitHubRepository } from '../github/githubRepository';
@@ -559,12 +559,12 @@ export class PullRequestCommentController extends CommentControllerBase implemen
559559
} catch (e) {
560560
// Ignore permission errors when removing reactions due to race conditions
561561
// See: https://github.com/microsoft/vscode/issues/69321
562-
const errorMessage = (e as Error).message || String(e);
562+
const errorMessage = formatError(e);
563563
if (errorMessage.includes('does not have the correct permissions to execute \'RemoveReaction\'')) {
564564
// Silently ignore this error - it occurs when quickly toggling reactions
565565
return;
566566
}
567-
throw e;
567+
throw new Error(errorMessage);
568568
}
569569
}
570570

0 commit comments

Comments
 (0)