chromaui / addon-visual-tests

Visual Tests addon for Storybook
MIT License
31 stars 2 forks source link

Handle unexpected errors from the runChromaticBuild method (cli misconfigured, missing build commmand, etc) #132

Closed weeksling closed 10 months ago

weeksling commented 10 months ago

This is a quick fix to handle unexpected errors from the cli run method. The UI portion of the failure is handled by the onBuildProgressOrError, but the try-catch is necessary to prevent the server from crashing. Added a console.error to log the error that was caught, however this error is not as useful as the actual CLI logs. I felt it would be useful to keep in case an error occurs that the cli doesn't properly log for.

linear[bot] commented 10 months ago
AP-3753 Storybook Server Crashes if there was an error running the CLI

When chromatic is misconfigured and a user attempts to run a build, when it fails it crashes the storybook-server. It properly displays a toast notification in the storybook ui, and it also logs the error from the cli, but the thrown error isn't caught, which causes the crash. A user reported this issue in the ext-visual-tests-addon channel. `Misconfiguration of the add-on, i.e. buildScriptName not provided, will cause the Storybook server to stop. Could we instead get an error message in the "Visual tests" panel in Storybook UI?` [https://chromaticqa.slack.com/archives/C05LRPYU649/p1697204966240229](https://chromaticqa.slack.com/archives/C05LRPYU649/p1697204966240229)