Presentation is loading. Please wait.

Presentation is loading. Please wait.

Error Handling Michael Smith President TeraTech, Inc ColdFusion, Database & VB custom development 800-447-9120.

Similar presentations


Presentation on theme: "Error Handling Michael Smith President TeraTech, Inc ColdFusion, Database & VB custom development 800-447-9120."— Presentation transcript:

1 Error Handling Michael Smith President TeraTech, Inc ColdFusion, Database & VB custom development http://www.teratech.com 800-447-9120

2 Introduction n Why handle errors? n Default CF handler u Display u Error log n Professional n Security n Logging/Email

3 Overview Here is what we will be covering:  Types of errors  Administrator settings  CFERROR  CFCATCH/CFTRY/CFTHROW  Error logging  Error Tips

4 Types of Errors n Syntax u CF u SQL (runtime) n Database u Connection u permissions n Includes n Objects n Expressions n Locking n Other, 404, 403 etc

5 Server config

6 CFERROR n n Only affects display of message n No CF code in handling page - just “error.” Variables: u Diagnostics, MailTo, DateTime, Browser, RemoteAddress, HTTPReferer, Template, QueryString n Use javascript to resubmit to CFML OnLoad

7 Structured Error Handling n Some terms n Exception = error n Throw = control move to error handler. Error is Raised n Try = block to try and find errors n Catch = receive the error and process

8 CFTRY/CFCATCH you code here… handle handle

9 CFCATCH variables n CFCATCH. u Detail u Message u NativeErrorCode * u SQLState * u Type * = (database only)

10 Logging errors What do you do when you catch an error? n CFMAIL yourself n Append to table or text file n Send to error report or feedback page n CFABORT or Resume processing

11 CFTHROW n Create your own errors n Jump out of loops etc - a GOTO for CF. n Test error handling

12 Error issues n Don’t use CFTRY in application.cfm as will never end (Though what about OnRequestEnd.cfm?) n Cover whole page in CFTRY n No code between and n Catch expected errors separately - eg object down - and offer retry

13 CF log files n C:\CFUSION\LOG\ n C:\CFUSION\MAIL\LOG\ n Free log viewer from http://logview.kickads.com/logviewer/ (see next page for screen shot)

14 Logviewer

15 See also n Studio Debugger n Admin debug options n Server monitors n 404 error handler

16 Resources n CFDOCS n Ben Forta Advanced Book Ch 19 n cf-talk email list n http://www.houseoffusion.com


Download ppt "Error Handling Michael Smith President TeraTech, Inc ColdFusion, Database & VB custom development 800-447-9120."

Similar presentations


Ads by Google