Browse files

better error message for unresolved module

When a module cannot be found, inform the user about the parent filename
for tracking down a bad require path easier.
  • Loading branch information...
1 parent 44c7f93 commit 51f04501fa718641e9731109ff4756ad7ef7a04a @defunctzombie defunctzombie committed Oct 31, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 index.js
View
4 index.js
@@ -64,9 +64,9 @@ function from_source(source, parent, cb) {
};
var full_path = lookup_path(req, parent);
-
if (!full_path) {
- return cb(new Error('unable to find module: ' + req));
+ return cb(new Error('Cannot find module: \'' + req + '\' ' +
+ 'required from ' + parent.filename));
}
var paths = parent.paths.concat(node_module_paths(full_path));

0 comments on commit 51f0450

Please sign in to comment.