Skip to content Skip to sidebar Skip to footer

Prototype Callback Functions Swallowing Exceptions

Using Prototype version 1.6.0.2. I have a common problem where exceptions are being swallowed when they are thrown in a callback function, typically when I am trying to handle the

Solution 1:

As of today, this is known behaviour:

http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/e71c7a6bfb656380/7d1c8a23edc07f03?lnk=gst&q=exception+swallowed#

There is a ticket in for an enhancement to deal with these swallowed exceptions here:

https://prototype.lighthouseapp.com/projects/8886/tickets/634-no-exception-on-error-in-oncreate-method-of-ajaxrequest

One work-around suggested is to add the following code (thanks Glenn Maynard!):

Ajax.Responders.register({ 
        onException: function(request, exception) { 
                (function() { throwexception; }).defer(); 
        } 
});

Hope that helps others with the same issue until a more permanent solution is implemented.

Post a Comment for "Prototype Callback Functions Swallowing Exceptions"