From f7d51c750f1405a2aa0a979f34f9120b6ff7d946 Mon Sep 17 00:00:00 2001 From: Dave Sibiski Date: Wed, 15 Jul 2015 08:24:01 -0700 Subject: [PATCH] [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 --- .../src/DependencyResolver/DependencyGraph/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/react-packager/src/DependencyResolver/DependencyGraph/index.js b/react-packager/src/DependencyResolver/DependencyGraph/index.js index 42c1a485..e05575db 100644 --- a/react-packager/src/DependencyResolver/DependencyGraph/index.js +++ b/react-packager/src/DependencyResolver/DependencyGraph/index.js @@ -150,7 +150,16 @@ class DependencyGraph { getOrderedDependencies(entryPath) { 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) { throw new NotFoundError(