Connecting Tech Pros Worldwide Help | Site Map

Using try / catch to send alerts

Haitashi's Avatar
Member
 
Join Date: Jun 2007
Location: Orlando, FL
Posts: 94
#1: Oct 29 '07
Hi guys!

Our website is configured so that when an error occurs an email containing the exception info is sent to us and the user sees a customized error webpage template. This is great and all but we've stumbled onto one particular case where we want the email but we don't want the application to stop and show the custom error page, we just want the email with the info be sent while the user can still browse around.

With that being said:
Expand|Select|Wrap|Line Numbers
  1.  
  2. <cftry>
  3.     <cfset Variables.temp = Variables.oStaffMember.load(Variables.nAdTeacherID)>
  4. <cfcatch>
  5.     <cfcatch type="API.AVS.Validation">
  6.         >>What can I put here?<<
  7.  
  8. </cfcatch>
  9. </cftry>
I'd like the application to try to load the staff member (line2) and if there is no staff member present (therefore no ID) then I want to put in line 5 the code that will give me the behavior I explained before?

Any ideas?
Thanks!
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Oct 30 '07

re: Using try / catch to send alerts


You don't have to put anything. Once the error is caught, the user can see whatever output is within cfcatch and the rest of the page will be displayed.
Haitashi's Avatar
Member
 
Join Date: Jun 2007
Location: Orlando, FL
Posts: 94
#3: Oct 30 '07

re: Using try / catch to send alerts


Really? lol

Didn't think it was that simple.

Thanks!
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#4: Oct 30 '07

re: Using try / catch to send alerts


You're welcome. If only every problem were that simple, eh?
Haitashi's Avatar
Member
 
Join Date: Jun 2007
Location: Orlando, FL
Posts: 94
#5: Nov 6 '07

re: Using try / catch to send alerts


^_^ You said it........
Reply