| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Add .catch() handlers to promise chains in whitespace-async.js files to prevent unhandled rejections and provide clear error messages.
…e errors gracefully:
| Back | FazBrowse Home | New Git URL |
Add .catch() handlers to promise chains in whitespace-async.js files to prevent unhandled rejections and provide clear error messages.
Summary
Fix unhandled promise rejections in whitespace-async.js scripts that occur when ESLint 9 loads the config or when CLIEngine is unavailable.
Problem
The onlyErrorOnRules(...).then(...) promise chain lacked a .catch() handler. If the promise rejects, it causes an unhandled rejection, potentially crashing the process. Additionally, child process errors or non-JSON output could cause JSON.parse(stdout) to fail with unclear errors during config loading.
Solution
Added .catch() handlers to log errors to stderr and exit with code 1, ensuring graceful failure and better error visibility.
Files Changed
Testing
Verified scripts run without unhandled rejections in both packages.