Forum Discussion

Stoplight's avatar
Stoplight
Community Manager
5 months ago

Spectral crashing with no error message (bundleAndLoadRuleset function)

Originally posted by user Mobyh to the Stoplight Community on 02/03/2023 at 14:45 ET.

The documentation (https://docs.stoplight.io/docs/spectral/f8921361d3f05-error-handling#rulesets) only mentions "WILL bail", but doesn't give any indication on how to catch or handle said exceptions.

Specifically the bundleAndLoadRuleset when given an invalid ruleset path just crashes the app, but there's no way to catch this exception or log what the issue is. I've tried using try/catch, .then(), .catch(), as well as process.on('unhandledRejection') and process.on('uncaughtException'), but none of these have been able to catch or log any kind of exception.

I found this issue by testing the edgecase, and I understand that spectral won't work if a ruleset can't be loaded, but I feel like instead of crashing some kind of exception should be logged instead of just crashing altogether.

No RepliesBe the first to reply