osmanraifgunes osmanraifgunes - 1 month ago 12
Node.js Question

Bluebird throwing exception at source code

I am using bluebirdjs for nodejs application. It throws an exception from its source code.

Line :

try {throw new Error(); } catch (e) {ret.lastLineError = e;}


Path : bluebird/js/release/util.js

Line : 374

This exception seems unnecessary to me. It only throws exception. Is it rational to delete this line?

Same code also exists inside async.js at line 3.

Answer

In IE an Error object will not have a .stack property unless it goes a through try catch. The .stack property is needed to see which line and file the code is in.

ret.lastLineError = new Error() would therefore only work in firefox and chrome