Failed jobs should be able to return an object in the job callback
When failing a job by passing a parameter into the first argument of the done() callback, this object usually gets converted to a string. It would offer more flexibility to the pass back the object without calling toString().
Here is the code that converts the error parameter into a string https://github.com/Automattic/kue/blob/master/lib/queue/worker.js#L126
Passing an object on success does not get converted, see https://github.com/Automattic/kue/blob/master/lib/queue/worker.js#L193
As a workaround, one can fail a jobs like this in order to get an object passed back
done({message: {foo:'bar'}});
+1
It would be very handy to be able to pass the error object through, as on the producer side of things, I subscribe to a job once it's been created, and then act upon the result back, and only being able to in effect put a string into the error back is a little limiting.
I did a similar workaround to Andrew, except I found that his way, the error object is not maintained and cannot be seen in the GUI, so I simply JSON.stringify an object into the err.message then parse it back out on the producer side.
+1
+1
A PR would be welcome...
+1