node-sync icon indicating copy to clipboard operation
node-sync copied to clipboard

Thrown errors are silent

Open testerez opened this issue 10 years ago • 2 comments

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

testerez avatar Dec 11 '15 22:12 testerez

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);
});

talha-asad avatar Jan 15 '16 17:01 talha-asad

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.

airs0urce avatar Apr 16 '16 16:04 airs0urce