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.
Comment | File | Size | Author |
---|---|---|---|
#2 | ctools-exception_handling_in_forms_2362977_2.patch | 1.55 KB | Adam Clarey |
#1 | ctools-exception_handling_in_forms_2362977_1.patch | 1.55 KB | Adam Clarey |
unhandled-exception.png | 325.35 KB | Adam Clarey |
Comments
Comment #1
Adam Clarey CreditAttribution: Adam Clarey commentedComment #2
Adam Clarey CreditAttribution: Adam Clarey commentedMistake in last patch