ZachSchneider [dot] com
  • Facebook
  • Google
  • Twitter
  • Home
  • About Me
  • Terms of Use
  • Archive
  • Sitemap
Home» Fun » ColdFusion Try and Catch

ColdFusion Try and Catch

Posted on July 27, 2009 by Zach in Fun - No Comments

In order for your code to directly handle an exception, the tags in question must appear within a cftry block. It is a good idea to enclose an entire application page in a cftry block. You then follow the cftry block with cfcatch blocks, which respond to potential errors. When an exception occurs within the cftry block, processing is thrown to the cfcatch block for that type of exception.

Here is an outline for using cftry and cfcatch to handle errors:

<cftry>
   Put your application code here ...
   <cfcatch type="exception type1">

      Add exception processing code here ...
   </cfcatch>
   <cfcatch type="exception type2">
      Add exception processing code here ...
   </cfcatch>

   ...
   <cfcatch type="Any">
      Add exception processing code appropriate for all other exceptions
here ...
   </cfcatch>
</cftry>
Code, ColdFusion, How to..., Web Dev, Web Development

Search

Facebook

Tags

Apache Apple bar Beer Bill Gates cheat sheet Chicago Code comic dating Download Day Election 2008 Firefox 3 flash Fun Geek Hackerspace How to... Internet Explorer Life Linux mac Microsoft Movies MySQL Nerd News PHP pickup lines politics quote Software Tech Twitter ubuntu virus vote Web Dev Web Development Windows Wine women Wordpress writings YouTube

Archives

  • December 2011
  • October 2011
  • September 2011
  • July 2011
  • May 2011
  • April 2011
  • January 2011
  • September 2010
  • August 2010
  • June 2010
  • May 2010
  • March 2010
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008
  • March 2008
  • February 2008
  • January 2008
  • December 2007
  • November 2007
  • October 2007
  • September 2007
  • August 2007
  • July 2007
  • June 2007
  • May 2007
  • March 2007
  • February 2007

(c) 2012 ZachSchneider [dot] com