ColdFusion 9.0 Resources |
Creating an error application pageThe following table lists the rules and considerations that apply to error application pages:
The following table describes the variables available on error pages: Exception error pages can also use all of the exception variables listed in the section Exception information in cfcatch blocks. To use these variables, replace the cfcatch prefix with cferror or error. For example, to use the exception message in an error page, refer to it as error.message. In general, production Exception and Request pages should not display detailed error information, such as that supplied by the error.diagnostics variable. Typically, Exception pages e-mail detailed error information to an administrative address or log the information using the cflog tag instead of displaying it to the user. For more information on using the cflog tag, see Logging errors with the cflog tag. Example of a request error pageThe following example shows a custom error page for a request error: <html> <head> <title>Products - Error</title> </head> <body> <h2>Sorry</h2> <p>An error occurred when you requested this page.</p> <p>Please send e-mail with the following information to #error.mailTo# to report this error.</p> <table border=1> <tr><td><b>Error Information</b> <br> Date and time: #error.DateTime# <br> Page: #error.template# <br> Remote Address: #error.remoteAddress# <br> HTTP Referer: #error.HTTPReferer#<br> </td></tr></table> <p>We apologize for the inconvenience and will work to correct the problem.</p> </body> </html> Example of a validation error pageThe following example shows a simple custom error page for a validation error: <html> <head> <title>Products - Error</title> </head> <body> <h2>Data Entry Error</h2> <p>You failed to correctly complete all the fields in the form. The following problems occurred:</p> #error.invalidFields# </body> </html> |