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

Standardized error handling #1618

Closed
P0lip opened this issue May 12, 2021 · 0 comments
Closed

Standardized error handling #1618

P0lip opened this issue May 12, 2021 · 0 comments
Assignees
Labels
chore tech-debt v6 Scheduled to be released in v6
Milestone

Comments

@P0lip
Copy link
Contributor

P0lip commented May 12, 2021

Logging in Spectral is not particularly standardized now and needs an overall improvement.
At present, we can distinguish at least 3 approaches:

  • using any console.* calls (sometimes silenced if --quiet flag is passed, but not always)
  • throwing an error and not handling it too well
  • on rare occasions, we push a validation result.

Here's what I propose.

For actual logging let's setup up something similar to @stoplight/reporter. I'm not saying we should include the project, as it's tied to Sentry and an array of other libraries, but we can incorporate the same pattern.

If something is considered to be an exception, let's not use console.warn or console.error, but simply abort the process the exception occurred in, regardless of its place - this means linting can also be canceled and result in an error.

Examples:

Related issues: #1096

@P0lip P0lip changed the title Spectral v6 - error handling Standardized error handling May 12, 2021
@P0lip P0lip added this to the v6.0 milestone May 12, 2021
@P0lip P0lip added chore tech-debt v6 Scheduled to be released in v6 labels May 12, 2021
@P0lip P0lip self-assigned this May 28, 2021
@P0lip P0lip closed this as completed Jun 8, 2021
@P0lip P0lip reopened this Jun 8, 2021
@P0lip P0lip closed this as completed Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore tech-debt v6 Scheduled to be released in v6
Projects
None yet
Development

No branches or pull requests

2 participants