Skip to content

Commit

Permalink
Merge pull request #27 from russmatney/master
Browse files Browse the repository at this point in the history
updates render callback style to follow node convention
  • Loading branch information
TJkrusinski committed Sep 27, 2014
2 parents 535c22c + b2a1bae commit e32877c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
};
2 changes: 1 addition & 1 deletion tests/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down

0 comments on commit e32877c

Please sign in to comment.