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

feature request: whole process to fail when some process fails #224

Open
tnyo43 opened this issue Mar 19, 2024 · 0 comments · May be fixed by #228
Open

feature request: whole process to fail when some process fails #224

tnyo43 opened this issue Mar 19, 2024 · 0 comments · May be fixed by #228

Comments

@tnyo43
Copy link

tnyo43 commented Mar 19, 2024

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.

} catch (error) {
const { message, file, line, column } = error as SassError;
const location = file ? ` (${file}[${line}:${column}])` : "";
alerts.error(`${message}${location}`);
}

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... 🤔

// Wait for all the type definitions to be written.
await Promise.all(files.map((file) => writeFile(file, options)));

Steps to Reproduce (for bugs)

reproduction

  1. clone the repository
  2. run npm install
  3. run 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

Context

I've been confused because the generation process had succeeded but the files had been not created.

Your Environment

  • Version used: 8.0.0
  • Operating System and versions: macOS 14.0 (23A344)
  • Link to your project: N/A
@tnyo43 tnyo43 changed the title want a process to fail when some generations fail feature request: a process to fail when some generations fail Apr 8, 2024
@tnyo43 tnyo43 changed the title feature request: a process to fail when some generations fail feature request: whole process to fail when some process fails Apr 8, 2024
@tnyo43 tnyo43 linked a pull request Apr 30, 2024 that will close this issue
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 a pull request may close this issue.

1 participant