Skip to content

Commit

Permalink
chore: throw entire error message on random failure
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenisx committed Sep 9, 2022
1 parent a70aa17 commit ab0045a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 31 deletions.
34 changes: 4 additions & 30 deletions docs/debug-extension.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# Debug extension

Since `v1.4.1` this extension has started to log parser errors with line number details, so that
developers who are using this extension can help file better bugs with details on cause of the issue.
This will help maintainers of this extension to quickly resolve the issue, with provided reproduction
of the issue.

## Test the extension in isolation

- Disable all extensions
Expand Down Expand Up @@ -35,31 +30,10 @@ Open your deveoper tools form VSCode `Help` menu:
Find the error/warning in the VSCode devtools view.
The error will have the following structure:

```ts
[Extension Host] {
"name": "CssSyntaxError",
"reason": string,
"file": "path to file that failed to parse",
"line": number, // Line number in the file where the parser failed
"column": number, // Column number in the line above where the parser failed
"endLine": number,
"endColumn": number
}
```yml
[cssvar]: ERROR MESSAGE
```
> **Note:** CSSVar Extension v1.4.3 will add extension name for each of these logs printed
> by the extension, for it to be found easily.
Check the line/column number in the file path mentioned in the above error, and provide
those details when raising a new issue.

For e.g. check the following GIF, which demonstrates the error while parsing an SCSS file:

![parser-error](https://user-images.githubusercontent.com/11786283/179459517-0b96c2ad-bb3a-4cfe-b653-20be78d0d27e.gif)

In the above gif, the extension setup wasn't done properly for SASS/SCSS files, as mentioned
in [Custmize Extension](./customize-extension.md) doc.
Thus, the extension fails to parse [SASS Interpolation](https://sass-lang.com/documentation/interpolation).
> Add the filter `[cssvar]:` in the DevTools Console, for better visibility.

This can be fixed if developer sets [postcss-scss](https://github.com/postcss/postcss-scss)
syntax for the parser, as defined in [Adding Support for Custom Syntax](./customize-extension.md#adding-support-for-any-new-sytax).
Please share the entire error message when opening any issue. :bow:
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export const getCSSErrorMsg = (
2
);
}
return JSON.stringify(error);
return error;
};

export const getActiveRootPath = (firstFolderPath = CACHE.activeRootPath) => {
Expand Down

0 comments on commit ab0045a

Please sign in to comment.