@preserveTry Annotation?

137 views
Skip to first unread message

Thanasis Polychronakis

unread,
May 27, 2012, 9:08:51 AM5/27/12
to Closure Library Discuss
I was reading the source of debug.js and noticed a /* @preserveTry */
annotation just before a try{} statement...
http://code.google.com/p/closure-library/source/browse/trunk/closure/goog/debug/debug.js#119

Is this annotation required? What are its effects? I could not find
any documentation about it...

Please let us know if we should start using it in our codebase... We
use try{}catch statements extensively...

Thank you

Dan Pupius

unread,
May 29, 2012, 8:41:33 PM5/29/12
to closure-lib...@googlegroups.com
There's a compiler pass (or was, not sure if its still around) for stripping try..catch blocks.  This was to make debugging in Internet Explorer easier, since there was no first-chance exception handling.  You'd use try...catches to handle errors in prod, then when debugging you'd strip them so you could get the debugger to stop at the right place.

@preserveTry was added to handle cases where exceptions are expected to occur and be caught as part of normal operation.
Reply all
Reply to author
Forward
0 new messages