0

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.

2
  • The catch block has a side effect so you can't delete it without reasonably expecting some functionality to change. Commented Oct 20, 2016 at 11:33
  • 1
    But try block will always throw exception. It is someting like if(true){}. It should be like "ret.lastLineError = new Error();". But this method is looking like a bug or forgotten when publishing. Commented Oct 20, 2016 at 11:40

1 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

1 Comment

So it will also get the stack from the throw and not the new Error, wouldn't it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.