balderdashy/waterline — pull request #191 by leedm777 (2013-12-05 14:56:55+00:00)
Title: Fix error handling in Deferred's promise functions

With Q promises, if the then(), fail() or spread() handlers throw an
exception, the promise is rejected. The wrapper functions in Deferred,
however, were simply throwing those exceptions on up.

Rather than try to duplicate those functions in waterline, this patch
adds a toPromise() method to Deferred which simply executes the query
and creates a Q Promise with the result. Then then(), fail() and
spread() functions are then just wrappers calling those methods on the
Promise.