How to Display a Custom Error Screen When Rebooting CF

How to Display a Custom Error Screen When Rebooting CF thumbnail
ColdFusion allows to add custom error messages to web pages

The ColdFusion software allows you to write custom event triggers and place your code on the web page to display error messages. There are two type of error messages that are processed in the CF transaction: general error messages that are displayed on top of the page during CF server rebooting and field error messages that are displayed right after the data field that caused the error. The custom code with event trigger must be inserted in the web page to display a custom error screen when rebooting CF.

Instructions

    • 1

      Click the "Start" button in the Windows and select "Flex ColdFusion Editor" from the "All Programs" menu.

    • 2

      Add the following code after the <cfscript> tag in your CF script:

      <cfset myErrorObjectName = Request.tNG_CreateObject("tNG_error")>

      <cfset myErrorObjectName.init("My custom error message to be displayed", Request.KT_array(), Request.KT_array())>

      to create a new instance of the error object.

    • 3

      Add the following code after the "Custom Trigger" line of the CF script:

      function Trigger_Custom(tNG) {

      if (error_condition) {

      myErrorObjectName = Request.tNG_CreateObject("tNG_error");

      myErrorObjectName.init("My custom error message to be displayed", Request.KT_array(), Request.KT_array());

      return myErrorObjectName;

      }

      return Request.KT_Null;

      }

      to display a custom error screen when rebooting CF.

    • 4

      Replace both instances of the text "My custom error message to be displayed" with the message you want to appear if the error occurs.

Related Searches:

References

  • Photo Credit Jupiterimages/Photos.com/Getty Images

Comments

You May Also Like

Related Ads

Featured