diff --git a/index.js b/index.js index 7e1d4eb..de11b20 100644 --- a/index.js +++ b/index.js @@ -117,19 +117,19 @@ exports.render = function(address, file, options, callback) { options = merge(defaults, options); child.supports(function(support){ - if (!support) callback(true, 'PhantomJS not installed'); + if (!support) callback(new Error('PhantomJS not installed')); var ps = child.exec(address, file, options); ps.on('exit', function(c, d){ - if (c) return callback(true, 'Conversion failed with exit of '+c); + if (c) return callback(new Error('Conversion failed with exit of '+c)); var targetFilePath = file; if (targetFilePath[0] != '/') targetFilePath = filePath + '/' + targetFilePath; - return callback(false, targetFilePath); + return callback(null, targetFilePath); }); }); }; diff --git a/tests/pdf.js b/tests/pdf.js index 1fc7f02..5722c56 100644 --- a/tests/pdf.js +++ b/tests/pdf.js @@ -115,7 +115,7 @@ describe('pdf#render()', function(){ it('renders a pdf with a callback style', function(d){ this.timeout(5000); Pdf.render('http://www.google.com', 'google2.pdf', function(err, file){ - assert.equal(err, false); + assert.equal(err, null); assert.equal(FP + '/google2.pdf', file); d(); });