By default, ColdFusion generates its own error messages when it encounters errors. In addition, it provides a variety of tools and techniques for you to customize error information and handle errors when they occur. You can use any of the following error-management techniques.

  • Specify custom pages for ColdFusion to display in each of the following cases:
    • When a ColdFusion page is missing (the Missing Template Handler page)
    • When an otherwise-unhandled exception error occurs during the processing of a page (the Site-wide Error Handler page)
      You specify these pages on the Settings page in the Server Settings page in the ColdFusion Administrator; for more information, see the ColdFusion Administrator Help.
  • Use the cferror tag to specify ColdFusion pages to handle specific types of errors.
  • Use the cftrycfcatchcfthrow, and cfrethrow tags to catch and handle exception errors directly on the page where they occur.
  • In CFScript, use the try and catch statements to handle exceptions.
  • Use the onError event in Application.cfc to handle exception errors that are not handled by try/catch code on the application pages.
  • Log errors. ColdFusion logs certain errors by default. You can use the cflog tag to log other errors.
    The following information is detailed in the next few topics:
  • The basic building blocks for understating types of ColdFusion errors and how ColdFusion handles them
  • How to use the cferror tag to specify error-handling pages
  • How to log errors
  • How to handle ColdFusion exceptions

    Note: Information about using the cftry and cfcatch tags is provided, but not the equivalent CFScript try and catch statements. The general discussion of exception handling applies to tags and CFScript statements. However, the code that you use and the information available in CFScript differs from the information in the tags. For more information on handling exceptions in CFScript, see Handling errors in UDFs.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy