Open tnyo43 opened 8 months ago
Your issue may already be reported! Please search on the issue tracker before creating one. <- DONE
If generation processes for invalid scss files fail, I want the entire process to fail as well.
Error messages for invalid scss files are displayed, but the entire process finishes successfully.
I think this behavior is come from the code below. https://github.com/skovy/typed-scss-modules/blob/546dba68e624e6d632618b6a419892869fc63cb0/lib/core/write-file.ts#L71-L75
When an error is thrown, it catches but not throw another error again.
We may be able to just re-throw the error. However, I read this comment and am thinking we need some tricks... :thinking: https://github.com/skovy/typed-scss-modules/blob/546dba68e624e6d632618b6a419892869fc63cb0/lib/core/generate.ts#L28-L29
reproduction
npm install
npm run generate
You will see some thing like below but the whole process succeeded:
% npm run generate > reproduce-typed-scss-modules-process-want-fail@1.0.0 generate > typed-scss-modules src/**/*.module.scss --implementation sass Found 2 files. Generating type definitions... expected "}". ╷ 9 │ // } │ ^ ╵ src/style2.module.scss 9:5 root stylesheet (/path/to/reproduce-typed-scss-modules-process-want-fail/src/style2.module.scss[9:5]) [GENERATED TYPES] src/style1.module.scss.d.ts
I've been confused because the generation process had succeeded but the files had been not created.
Your issue may already be reported! Please search on the issue tracker before creating one. <- DONE
Expected Behavior
If generation processes for invalid scss files fail, I want the entire process to fail as well.
Current Behavior
Error messages for invalid scss files are displayed, but the entire process finishes successfully.
Possible Solution
I think this behavior is come from the code below. https://github.com/skovy/typed-scss-modules/blob/546dba68e624e6d632618b6a419892869fc63cb0/lib/core/write-file.ts#L71-L75
When an error is thrown, it catches but not throw another error again.
We may be able to just re-throw the error. However, I read this comment and am thinking we need some tricks... :thinking: https://github.com/skovy/typed-scss-modules/blob/546dba68e624e6d632618b6a419892869fc63cb0/lib/core/generate.ts#L28-L29
Steps to Reproduce (for bugs)
reproduction
npm install
npm run generate
You will see some thing like below but the whole process succeeded:
Context
I've been confused because the generation process had succeeded but the files had been not created.
Your Environment