Last Updated: February 25, 2016
·
689
· thanpolas

Always ground your exposed callbacks

Always ground the callbacks that your API is exposing. If the consumer throws an exception, it will bubble up to your stack preventing further execution.

// ground callback exceptions
try{callback(true);}catch(ex){}

// ... or this part will never be reached
defer.resolve(true);

1 Response
Add your response

over 1 year ago ·

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside