assaf / node-passbook

iOS Passbook for the Node hacker
MIT License
280 stars 73 forks source link

Uncaught exception while .pipe(file) #21

Closed 18601673727 closed 9 years ago

18601673727 commented 9 years ago

Here's my code:

// Creating the .pkpass file.
var path = 'pass/' + passId + '.pkpass';
var file = fs.createWriteStream(path);

// Signing it.
pass.on('error', function (err) {
  // Error occurd while signing file,
  // so rollback database and delete it.
  Passbook.destroy(passId, after.destroy(res));
  fs.unlink(path, function (err) {
    if (err) return res.serverError(err);
    sails.log.info('Successfully deleted file at: ' + path);
  });
  return res.serverError(err);
}).pipe(file);
Error: connect ECONNREFUSED
  at errnoException (net.js:905:11)
  at Object.afterConnect [as oncomplete] (net.js:896:19) { [Error: connect ECONNREFUSED]