• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 12. ColdFusion Scripting > Exception Handling in <cfscript>

Exception Handling in <cfscript>

There are three levels of exception handling in ColdFusion:

  • Exceptions that you reasonably expect might happen within your code, such as a user-submitted zero value that is used as a divisor in a calculation. These exceptions are handled using try-catch constructs. Exceptions handled by try-catch constructs typically suggest alternate workflows, such as allowing the user to enter a different value.

  • Exceptions that do not have any alternate workflow, such as a failure to connect to the database, are handled by error-handling templates that are installed using <cferror> or handled by the onError method in Application.cfc.

  • Exceptions that are handled neither by try-catch constructs or installed error handlers fall through to the sitewide error handler, if one is installed (which it should be on a production system).


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint