Commit ea76c391 authored by Tomas Vik (OOO back on 2026-08-31)'s avatar Tomas Vik (OOO back on 2026-08-31) 🌴
Browse files

feat: detect revoked token and offer re-authentication

parent ab904806
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -26,6 +26,11 @@
        "title": "Remove Account from VS Code",
        "category": "GitLab"
      },
      {
        "command": "gl.validateAccounts",
        "title": "Validate GitLab Accounts",
        "category": "GitLab"
      },
      {
        "command": "gl.showIssuesAssignedToMe",
        "title": "Show Issues Assigned to Me",
+3 −0
Original line number Diff line number Diff line
@@ -29,6 +29,9 @@ module.exports = {
    this.supportThemeIcons = supportThemeIcons;
  },
  Uri,
  authentication: {
    getSession: jest.fn(),
  },
  comments: {
    createCommentController: jest.fn(),
  },
+12 −2
Original line number Diff line number Diff line
@@ -42,13 +42,23 @@ describe('handleError', () => {
    expect(executeCommand).toBeCalledWith(COMMAND_SHOW_OUTPUT);
  });

  it('shows UI error', async () => {
  describe('when handling an UI Error', () => {
    let showUiMock: jest.Func;

    beforeEach(() => {
      const error = new Error('test');
    const showUiMock = jest.fn().mockResolvedValueOnce(undefined);
      showUiMock = jest.fn().mockResolvedValueOnce(undefined);
      const testError: UiError = { ...error, showUi: showUiMock };

      handleError(testError);
    });

    it('shows UI error', async () => {
      expect(showUiMock).toHaveBeenCalled();
    });

    it('does not show the generic error UI', async () => {
      expect(vscode.window.showErrorMessage).not.toHaveBeenCalled();
    });
  });
});
+1 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ export const handleError = (e: Error): void => {
  log.error(e);
  if (isUiError(e)) {
    e.showUi().catch(log.error);
    return;
  }
  const showErrorMessage = async () => {
    const choice = await vscode.window.showErrorMessage(e.message, 'Show Logs');
+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
export const USER_COMMANDS = {
  ADD_ACCOUNT: 'gl.addAccount',
  REMOVE_ACCOUNT: 'gl.removeAccount',
  VALIDATE_ACCOUNTS: 'gl.validateAccounts',
  SHOW_ISSUES_ASSIGNED_TO_ME: 'gl.showIssuesAssignedToMe',
  SHOW_MERGE_REQUESTS_ASSIGNED_TO_ME: 'gl.showMergeRequestsAssignedToMe',
  OPEN_ACTIVE_FILE: 'gl.openActiveFile',
Loading