[Packager] Fix when loading a path that can't be handled

Summary:
[Packager] Adds `NotFoundError` when loading a path that can't be handled

Resolves https://github.com/facebook/react-native/issues/1944
Closes https://github.com/facebook/react-native/pull/1948
Github Author: Dave Sibiski <dsibiski@gmail.com>
This commit is contained in:
Dave Sibiski 2015-07-15 08:24:01 -07:00
parent 01d07a3eb6
commit f7d51c750f
1 changed files with 10 additions and 1 deletions

View File

@ -150,7 +150,16 @@ class DependencyGraph {
getOrderedDependencies(entryPath) { getOrderedDependencies(entryPath) {
return this.load().then(() => { return this.load().then(() => {
const absolutePath = path.resolve(this._getAbsolutePath(entryPath)); const absPath = this._getAbsolutePath(entryPath);
if (absPath == null) {
throw new NotFoundError(
'Could not find source file at %s',
entryPath
);
}
const absolutePath = path.resolve(absPath);
if (absolutePath == null) { if (absolutePath == null) {
throw new NotFoundError( throw new NotFoundError(