While you are learning to code in ColdFusion, you are bound to make some errors along the way. Unlike the
environment of HTML, ColdFusion is very strict when it comes to syntax. Fortunately, ColdFusion Server provides very useful feedback when it comes across an error.
Some errors are relatively
. For example, if you try to use a ColdFusion variable outside of a <CFOUTPUT> block, the page will continue to process. However, the
will see the literal
of the variable rather than its value, as
in Figure 1.14.
Figure 1.14. Incorrect use of
Most other errors will cause the page to stop processing. ColdFusion will return diagnostic information to the client browser to aid in solving the problem. In Figure 1.15, you can see that a typo in the Error2.cfm template causes ColdFusion to return some troubleshooting information.
Figure 1.15. Error2.cfm error output.
The diagnostic information returned from the ColdFusion Server indicates that it ran into problems trying to close the <CFOUTPUT> block on line 20 of the template. It goes on to say that the probable cause of the error is a misspelling of expression text. In addition, the error indicates that the last successful text that the server was able to parse was between line 17 and line 19. A closer examination of line 19 reveals the culprit, a missing quotation mark in the DateFormat() mask.
Figure 1.16 illustrates the error information you would receive if you neglected to use a closing </CFOUTPUT> tag.
Figure 1.16. Error3.cfm error output.