fix: don't error out while catching a buildStart
error
#422
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.
Summary
If an error occurs during the
buildStart
hook, make sure that thebuildEnd
hook doesn't hide the error with its own errorbuildDone
func had an uninitializedcache
var, as it's initialized inbuildStart
after this thrown errorTypeError: Cannot read property 'done' of undefined
(cache.done()
)聽#421TypeError: Cannot read property 'done' of undefined
(cache.done()
)聽#421 (comment)ConsoleContext
entirely by usingbuildStart
聽#414 + refactor(cache): simplify creating / using thecache
var聽#415Details
per in-line comment, if an error occurs during
buildStart
initialization, then thecache
may not exist yet duringbuildDone
context.error
instead ofthrow
during initialization (from theoptions
->buildStart
change),buildEnd
will run during initialization - and thecache
var is initialized inbuildStart
as well, so if an error occurs before then, thecache
won't exist - we should gracefully handle this in all cases, since it's possible that even creating thecache
could throw an errorthis error was hiding the underlying error, which was problematic for DX as well as bug reports (see my issue follow-up)
add an integration test for
tsconfig
to make sure this code workstsconfig
integration tests (that were moved to unit tests), this covers all cases ofbuildStart
errors, and is not specific to the differenttsconfig
errors (unlike the unit tests)Misc Notes
Would be good for a patch release! Especially as this error currently hides actual errors 馃槙