Improve error reporting for SHA-1 retrieval

Reviewed By: rafeca

Differential Revision: D7642401

fbshipit-source-id: b04610abcfbb33629db640c7d97083722db1fe17
This commit is contained in:
Miguel Jimenez Esun 2018-04-16 16:04:04 -07:00 committed by Facebook Github Bot
parent c56e414560
commit c67b6317fa
1 changed files with 7 additions and 1 deletions

View File

@ -237,7 +237,13 @@ class DependencyGraph extends EventEmitter {
getSha1(filename: string): string {
// $FlowFixMe: TODO T27501330: Use getSha1 from HasteFS.
const sha1 = this._hasteFS._files[filename][4];
const file = this._hasteFS._files[filename];
if (!file) {
throw new ReferenceError(`File ${filename} is not tracked by haste-map`);
}
const sha1 = file[4];
if (!sha1) {
throw new ReferenceError(`SHA-1 for file ${filename} is not computed`);