Created
October 23, 2012 02:39
-
-
Save aaronj1335/3936362 to your computer and use it in GitHub Desktop.
optionally returning a deferred
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
something.then(function() { | |
if (config.somethingElse) { | |
return somethingElse(); | |
} | |
}); |
also: i'm using q, and if i want to ensure that any exceptions thrown are caught, i would need to add a .end()
after the .then()
correct?
It's perfectly ok. The final result would be undefined or resolved value of promise returned by somethingElse
. Test it :-)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
so assuming that
something
andsomethingElse
return promises, the return value of the callback passed to.then()
will return either a promise, or undefined.is this ok? i'm paranoid that an error is going to get thrown and won't get caught.