Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better output formatting and error handling #71

Merged
merged 1 commit into from
Sep 8, 2023

Conversation

lkwdwrd
Copy link
Contributor

@lkwdwrd lkwdwrd commented Sep 8, 2023

What code changed, and why?

Previously when running previews, the output was a dump of JSON. This is not always very friendly. This adapts functions from DAS UI to format returns. In addition, extra data such as printed lines and instrumentation metrics are formatted much more clearly. The response is always at the (scrolled to) bottom so it is immediately visible.

In addition, non-200 API responses are handled and surfaced as an error pop-up instead of printing JSON to the results output window. This make is far easier to tell that something has gone wrong, and the EOPA generated message is presented to the user along with the API response code.

Definition of done

The user has nicely formatted output when running EOPA previews through VS Code.

How to test

You can install either from source code or from GitHub.

Install from source

  1. Switch to current branch.
  2. Run npm install.
  3. Open project in VSCode.
  4. In the debugger be sure you have "Run Extension" mode selected.
  5. Invoke "run" (F5).

Install from GitHub

  1. Go to the latest release on the release page.
  2. Download the additional version piggybacked into that release, labelled vscode-styra-2.0.0-next.1.vsix.
  3. Install via the standard command: code --install-extension vscode-styra-2.0.0-next.1.vsix

Exercise the Code

  • Set up an EOPA instance with some files. Run preview with various output options selected and observe the output
  • Set up invalid Rego and try to run it, observe that an error is reported.

Copy link
Member

@srenatus srenatus left a comment

Choose a reason for hiding this comment

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

Thanks!

@lkwdwrd lkwdwrd merged commit 05e9d9f into main Sep 8, 2023
4 checks passed
@lkwdwrd lkwdwrd deleted the luke/preview-pretty-output branch September 8, 2023 16:50
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.

2 participants