Using try / catch to send alerts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Haitashi
    New Member
    • Jun 2007
    • 96

    Using try / catch to send alerts

    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:
    Code:
    	
    <cftry>
    	<cfset Variables.temp = Variables.oStaffMember.load(Variables.nAdTeacherID)>
    <cfcatch>
    	<cfcatch type="API.AVS.Validation">
            >>What can I put here?<<
    		
    </cfcatch>
    </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
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    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.

    Comment

    • Haitashi
      New Member
      • Jun 2007
      • 96

      #3
      Really? lol

      Didn't think it was that simple.

      Thanks!

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        You're welcome. If only every problem were that simple, eh?

        Comment

        • Haitashi
          New Member
          • Jun 2007
          • 96

          #5
          ^_^ You said it........

          Comment

          Working...