ybogdanov / node-sync

Write simple and readable synchronous code in nodejs using fibers
MIT License
492 stars 70 forks source link

Thrown errors are silent #50

Open testerez opened 8 years ago

testerez commented 8 years ago

I'm not shure that it is actualy an issue but when I throw an exception I'm expecting it to be visible in the console output.

Here is a example code I run on node 5.1.0

'use strict'
let Sync = require('sync');
Sync(function(){
    throw 'error';
});

It does not print anything

talha-asad commented 8 years ago

try this instead:

'use strict'
let Sync = require('sync');
Sync(function(){
    throw 'error';
}, function(err, result) {
  if (err) return console.error('Error: ', err);
  console.log('Result: ', result);
});
airs0urce commented 8 years ago

I added pull-request. https://github.com/ybogdanov/node-sync/pull/53 Not sure why that line was commented, may be there is some reason, but now it works good for me.