Closed weeksling closed 10 months ago
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)
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.