Share this Page URL

Chapter 9. Troubleshooting Your ColdFusion Code - Pg. 181

181 Chapter 9. Troubleshooting Your ColdFusion Code After working through nearly half of this book, you have no doubt come across the infamous "Error Occurred While Processing Request" screen. This is what ColdFusion displays when it encounters an error. Often it is hard to put aside the frustration you feel when this happens, but that is what you need to do so that you can focus on the content of the error message and learn from what it's trying to tell you. ColdFusion error messages are packed with good information, but learning to interpret them can be a challenge for new developers. When an error happens, you need to correct, or debug, the error so that your script will run correctly. ColdFusion provides support for the debugging process in two important ways. First, you can use the ColdFusion Administrator to append debugging information to the end of each HTML page ColdFusion generates, and second, you can use ColdFusion Studio's built-in debugging features to stop the script at various points to inspect what's happening on the server. In this chapter, you'll learn how to · · · · Interpret common error messages and correct the underlying problems Activate debugging information using the ColdFusion Administrator Use CFML tags and functions to assist with debugging Employ ColdFusion Studio's debugging features Handling Common Error Messages Most of the problems you come across in your development work are caused by innocent typo- graphical errors. No matter how minor the typo seems though, ColdFusion will generate an entire page of information about the error. This can be an overwhelming amount of information for a new developer to digest, but after you learn how to identify key pieces of information in the error message, you can usually zero in on the source of the error very quickly. The next several sections show you common error messages and help you to interpret the meaning of each. Misspelled Tag or Attribute You can easily make a mistake when typing a tag's keyword or one of its attributes. Consider the following short example: <cfste firstName = "Mary"> <h1>Hello, <cfoutput>#firstName#</cfoutput>!</h1> The <cfset> tag is misspelled, so ColdFusion will not be able to recognize the tag. The corre- sponding error message is shown in Figure 9.1.