Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed `Job#error` for modules that throw strings or emit `error` even…

…ts with strings.
  • Loading branch information...
commit 6cfce8f432887957a8d6d538c7991bfc01dad2ce 1 parent 3813985
@rauchg rauchg authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 lib/queue/job.js
View
11 lib/queue/job.js
@@ -456,8 +456,15 @@ Job.prototype.state = function(state){
Job.prototype.error = function(err){
if (0 == arguments.length) return this._error;
- var str = err.stack || err.message
- , summary = str.split('\n')[0];
+
+ if ('string' == typeof err) {
+ var str = err
+ , summary = '';
+ } else {
+ var str = err.stack || err.message
+ , summary = str.split('\n')[0];
+ }
+
this.set('failed_at', Date.now());
this.set('error', str);
this.log('%s', summary);

0 comments on commit 6cfce8f

Please sign in to comment.
Something went wrong with that request. Please try again.