packager: Package.js: cover the error cases

Summary: In case the sync function throws, it wouldn't be handled through the promise anymore, that is not what we want. So we revert that in this changeset.

Reviewed By: davidaurelio

Differential Revision: D4754740

fbshipit-source-id: 4da360f4b629bbdf9cd284389060429cc9259c2c
This commit is contained in:
Jean Lauliac 2017-03-22 11:47:46 -07:00 committed by Facebook Github Bot
parent 51b44a5b52
commit ba88046c24
1 changed files with 2 additions and 2 deletions

View File

@ -67,13 +67,13 @@ class Package {
isHaste() {
return this._cache.get(this.path, 'package-haste', () =>
Promise.resolve(!!this.read().name)
Promise.resolve().then(() => !!this.read().name)
);
}
getName(): Promise<string> {
return this._cache.get(this.path, 'package-name', () =>
Promise.resolve(this.read().name)
Promise.resolve().then(() => this.read().name)
);
}