bmatcuk / stylelint-lsp

A stylelint Language Server
MIT License
46 stars 4 forks source link

Handle stylelint validation errors gracefully #18

Closed Gelio closed 3 years ago

Gelio commented 3 years ago

If the promise returned from the stylelint's validate function rejects, the error is now handled by logging it to stderr.

This means the rejection is no longer unhandled.

validate fails for me in projects where I did not have stylelint set up:

[ ERROR ] 2021-04-29T09:12:24+0200 ] ...nt_nvimCuKCET/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:457 ] "rpc" "stylelint-lsp" "stderr" "Error when trying to validate file:///home/grzegorz/projects/cloudify/cloudify-stage/test/cypress/integration/widgets/deployments_view_spec.ts Error: No configuration provided for /home/grzegorz/projects/cloudify/cloudify-stage/test/cypress/integration/widgets/deployments_view_spec.ts\n at module.exports (/home/grzegorz/projects/open-source/stylelint-lsp/node_modules/stylelint/lib/utils/configurationError.js:10:14)\n at /home/grzegorz/projects/open-source/stylelint-lsp/node_modules/stylelint/lib/getConfigForFile.js:56:11\n at async validate (/home/grzegorz/projects/open-source/stylelint-lsp/dist/validate.js:37:36)\n at async /home/grzegorz/projects/open-source/stylelint-lsp/dist/validate.js:118:17 {\n code: 78\n}\n"

codecov[bot] commented 3 years ago

Codecov Report

Merging #18 (bd989a5) into master (25891c7) will decrease coverage by 0.36%. The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #18      +/-   ##
==========================================
- Coverage   64.85%   64.48%   -0.37%     
==========================================
  Files           6        6              
  Lines         350      352       +2     
  Branches       57       57              
==========================================
  Hits          227      227              
- Misses        104      106       +2     
  Partials       19       19              
Impacted Files Coverage Δ
src/validate.ts 38.46% <0.00%> (-0.76%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 25891c7...bd989a5. Read the comment docs.

bmatcuk commented 3 years ago

I released v1.2.2 with this fix =)

Gelio commented 3 years ago

Great, I'm glad I could help 😄