Skip to content

Error reporting to VSCode OutputChannel

Problem to solve

In my experience today, there was very little information about what was working or not. The side pane simply stayed blank and did not show anything apart from the default text ("there is no XYZ assigned to you" etc.). Which makes it very hard to understand at what point something goes wrong or what might be the cause (connection to GitLab? authentication? extension not configured correctly?).

Proposal

Creating and logging to an OutputChannel (see https://code.visualstudio.com/api/references/vscode-api#window.createOutputChannel) instead of logging to console would probably make it easier for the user to understand what is happening (and what not).

Further details

In scope

  • bubble exceptions to the top-level client code (e.g. extension.js) and then log them to the output channel
  • make sure that exceptions are not silenced (by empty try/catch blocks)
  • stretch: separate exceptions from normal program flow - a lot of code in git_service.js and gitlab_service.js is using exceptions as a part of normal program flow (e.g. command returning empty result & command throwing exception is treated the same)
  • making sure that the OutputChannel is shown during automated integratin tests (it will help understanding what's wrong)

Out of scope

Links / references

Edited by Tomas Vik