cftry and cfcatch - catch exception and handle error
cftry.cfm
<!DOCTYPE html">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cftry and cfcatch tag example: how to catch exception and handle error</title>
</head>
<body>
<h2 style="color:DodgerBlue">ColdFusion cftry and cfcatch example</h2>
<cftry>
<!---Here i input wrong table name--->
<cfquery name="qEmployee" datasource="cfdocexamples">
SELECT * FROM Employeess
</cfquery>
<cfdump var="#qEmployee#">
<cfcatch type="any">
<cfoutput>
Error occured....<br /><br />
Message: <b>#cfcatch.Message#</b><br />
Detail: <b>#cfcatch.Detail#</b><br />
Type: <b>#cfcatch.Type#</b><br />
</cfoutput>
</cfcatch>
</cftry>
</body>
</html>
- cfdiv
- cfscript - array in script
- cfscript - assign variable in script
- cfscript - if else conditional statement in script
- cfscript - structure in script
- cfscript - switch, case, default statement in script
- cfscript - call user defined function in script
- cfscript - do while loop in script
- cfscript - for loop in script