I have a site that uses many modal forms for various tasks, occasionally as some forms involve external requests etc exceptions can occur when generating the form. It's not uncommon for exceptions/errors to occur generally, so to avoid going through each modal callback and adding the same try {}catch{} to every function it makes more sense to add this to the ctools_modal_form_wrapper() function so every form will be covered in every situation.

All the patch does is wrap the contents of this function in a try/catch, if an exception occurs it loads the modal with a sensible error message instead of the horrific ajax error popups that occur if exceptions are not handled.

This code is non-intrusive and should have no adverse effects on any site running it. It's simply adds exception handling.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Adam Clarey’s picture

Adam Clarey’s picture

Mistake in last patch