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

Task runner fails ungracefully when experiencing error #27295

Open
SiAdcock opened this issue Jul 9, 2024 · 0 comments
Open

Task runner fails ungracefully when experiencing error #27295

SiAdcock opened this issue Jul 9, 2024 · 0 comments

Comments

@SiAdcock
Copy link
Contributor

SiAdcock commented Jul 9, 2024

ISSUE

When the task runner encounters an error (e.g. scalafmt detects formatting issues), it falls over with a JavaScript error, and doesn't print the helpful error message telling the developer what to do next.

Steps to Reproduce

  • Add a bunch of random tabs and line breaks to a Scala file (e.g. FeatureSwitches.scala)
  • Kick off the scalafmt task in task-runner in the terminal by running $ ./tools/task-runner/runner.mjs validate-head/scala.mjs

Actual Results (include screenshots)

Screenshot 2024-07-08 at 16 05 58

There's a whole lot of noise and you have to hunt for the useful information and deduce what action to take. I believe the task-runner falls over, on line 109 of task-runner.mjs, because context is not available on the Error received by the catch().

This might have been introduced in the recent migration to ESM (#27262), although this is only a hunch.

On a broader point, I'm not sure if we need this much custom error handling, as I'd expect Listr to take care of it.

Expected Results (include screenshots)

I would expect to see a helpful error message, such as the one defined in scala.mjs:

Run ${chalk.blue('./sbt scalafmt')} to format Scala files.
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

No branches or pull requests

1 participant