feat: improve error handling within startCallback and endCallback #3969
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For Bugs and Features; did you add new tests?
Yes - added a test where a misconfigured devServer option will cause a error to be thrown. This is now caught and handled in the startCallback.
Motivation / Use-Case
The startCallback (and stopCallback) helpers in this version are implementing Promise.then rejected callback param (
Promise.then(success, error)
), but they aren't actually catching errors that occur in the process of start and stop.This change makes the util handle errors that occur from start, or downstream from start, making the utility a bit more helpful.
You can also see places in this repo's examples where startCallback expects to see an error and log it to the console, but prior to this change, thrown errors would not be handled nor logged in this way.
Breaking Changes
Additional Info