-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
When using .then - an exception thrown (such as a ReferenceError) gets swallowed up making debugging near impossible.
var Deferred = require( 'underscore.deferred' );
// using then won't throw any exceptions
var d1 = Deferred.Deferred();
d1.then( function( a ) {
console.log( 'success', a );
missing_var.destruction;
});
d1.resolve( 'test' );
// output:
// => success test
// using done/fail will
var d2 = Deferred.Deferred();
d2.done( function( a ) {
console.log( 'success', a );
missing_var.destruction;
});
d2.resolve( 'test' );
// output:
// => success test
// /tmp/deferred_bug/server.js:19
// missing_var.destruction;
// ^
// ReferenceError: missing_var is not defined
// at Object.<anonymous> (/private/tmp/deffered_Bug/wat.js:19:3)
// at _d.Callbacks.fire (/private/tmp/deffered_Bug/node_modules/underscore.deferred/underscore.deferred.js:149:36)
// at Object._d.Callbacks.self.fireWith (/private/tmp/deffered_Bug/node_modules/underscore.deferred/underscore.deferred.js:259:15)
// at Object._d.Callbacks.self.fire [as resolve] (/private/tmp/deffered_Bug/node_modules/underscore.deferred/underscore.deferred.js:266:16)
// at Object.<anonymous> (/private/tmp/deffered_Bug/wat.js:21:4)
// at Module._compile (module.js:449:26)
// at Object.Module._extensions..js (module.js:467:10)
// at Module.load (module.js:356:32)
// at Function.Module._load (module.js:312:12)
// at Module.runMain (module.js:492:10)I assume this has to do with the changes to .then to handle exception throwing - which sounds great but makes this kind of stuff a huge pain in the ass. For example, jQuery handle the exception fine: http://jsfiddle.net/danheberden/G5RFD/1/
Metadata
Metadata
Assignees
Labels
No labels