Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Better error messages on load/compile fail

  • Loading branch information...
commit abf773a516c097d23614e9916ae370af763e2374 1 parent 0084cbd
@chriso chriso authored
Showing with 6 additions and 7 deletions.
  1. +5 −6 lib/node.io/processor.js
  2. +1 −1  package.json
View
11 lib/node.io/processor.js
@@ -298,8 +298,7 @@ Processor.prototype.loadJob = function (job, options, callback) {
//Now that require.paths has gone away we have to jump through hoops.
- var tryPaths = [process.cwd() + '/', '']
- , notFound = /Cannot find/;
+ var tryPaths = [process.cwd() + '/', ''];
for (var jobPath, i = 0; i < tryPaths.length; i++) {
jobPath = tryPaths[i] + job;
@@ -308,12 +307,12 @@ Processor.prototype.loadJob = function (job, options, callback) {
this.processJob(job, require(jobPath), options, callback);
return;
} catch (e) {
- if (notFound.test(e.message)) {
+ if (new RegExp("Cannot find module '"+jobPath+"'").test(e.message)) {
this.status('Failed to load require(\'' + jobPath + '\') - not found', 'debug');
} else {
- this.status('Error: ' + e.message, 'debug');
- this.status('Trace: ' + JSON.stringify(e), 'debug');
- return callback('Failed to load job "' + job + '". Please check that the job exists and compiles correctly.');
+ this.status('Error: Failed to load job "' + job + '". Please check that the job exists and compiles correctly.', 'error');
+ throw e;
+ return callback('load error');
}
}
}
View
2  package.json
@@ -1,6 +1,6 @@
{ "name" : "node.io",
"description" : "A distributed data scraping and processing framework",
- "version" : "0.4.4",
+ "version" : "0.4.5",
"homepage" : "http://github.com/chriso/node.io",
"keywords" : ["data","mapreduce","map","reduce","scraping","html","parsing","parse","scrape","process","processing","data"],
"author" : "Chris O'Hara <cohara87@gmail.com>",
Please sign in to comment.
Something went wrong with that request. Please try again.