Improve error logging when rebuild fails

Summary: public

We're seeing intermittent errors on the packager when rebasing. Since this is very hard to repro lets add more logging to the warning we show just before starting to rebuild the entire haste map again

Reviewed By: frantic

Differential Revision: D2585427

fb-gh-sync-id: fbfa953f6c8ae78cbee2f3ab19ad494b084165c8
This commit is contained in:
Martín Bigio 2015-10-27 10:32:00 -07:00 committed by facebook-github-bot-9
parent 213c18d221
commit abeaa5bc9b

View File

@ -211,9 +211,13 @@ class DependencyGraph {
// we are in an error state and we should decide to do a full rebuild.
this._loading = this._loading.finally(() => {
if (this._hasteMapError) {
console.warn(
'Rebuilding haste map to recover from error:\n' +
this._hasteMapError.stack
);
this._hasteMapError = null;
// Rebuild the entire map if last change resulted in an error.
console.warn('Rebuilding haste map to recover from error');
this._loading = this._hasteMap.build();
} else {
this._loading = this._hasteMap.processFileChange(type, absPath);