Lift Promise javascript api

48 views
Skip to first unread message

Austen Holmes

unread,
Jun 29, 2016, 8:24:09 AM6/29/16
to Lift
Hi,

Lift's promise implementation specifies that errors are handled by passing a callback to .fail().  To make them more compatible with other js libraries (and async/await), would it make sense to add .catch() as an alias to .fail()?

In lift.js, on line 509, I've inserted the code in bold below:
self.fail = function(f) {
_failureFuncs.push(f);
if (_failed) {
 try { f(_failMsg); }
 catch (e) {
settings.logError(e);
 }
}

return self;
};

self.catch = self.fail;

Thanks,

-Austen

Antonio Salazar Cardozo

unread,
Jun 29, 2016, 6:06:36 PM6/29/16
to Lift
I'm down!
Antonio

Matt Farmer

unread,
Jul 1, 2016, 4:06:32 PM7/1/16
to lif...@googlegroups.com
Seems reasonable to me. Feel free to open a PR!


Matt Farmer Blog | Twitter
GPG: CD57 2E26 F60C 0A61 E6D8  FC72 4493 8917 D667 4D07

On Jun 29, 2016, at 6:06 PM, Antonio Salazar Cardozo <savedf...@gmail.com> wrote:

I'm down!
Antonio

--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages