-
Notifications
You must be signed in to change notification settings - Fork 354
Expand file tree
/
Copy pathcfcatch.json
More file actions
36 lines (34 loc) · 4.42 KB
/
Copy pathcfcatch.json
File metadata and controls
36 lines (34 loc) · 4.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{
"name":"cfcatch",
"type":"tag",
"syntax":"<cfcatch>",
"script":"catch (any e) { }",
"related":["cftry","cffinally"],
"description":"Used inside a cftry tag. Together, they catch and process\n exceptions in CFML pages. Exceptions are events that\n disrupt the normal flow of instructions in a CFML page,\n such as failed database operations, missing include files, and\n developer-specified events.",
"params": [
{"name":"type","description":"`application`: catches application exceptions\n`database`: catches database exceptions\n`template`: catches ColdFusion page exceptions\n`security`: catches security exceptions\n`object`: catches object exceptions\n`missingInclude`: catches missing include file exceptions\n`expression`: catches expression exceptions\n`lock`: catches lock exceptions\n`custom_type`: catches the specified custom exception type that is defined in a cfthrow tag\n `java.lang.Exception`: catches Java object exceptions\n `searchengine`: catches Verity search engine exceptions\n `any`: catches all exception types","required":false,"default":"any","type":"string","values":["application","database","template","security","object","missinginclude","expression","lock","custom_type","searchengine","any"]},
{"name":"output","description":"Within a cfcatch block, the active exception property structure can be accessed as the following variables:","type":"struct","values":["`cfcatch.type`: Type: Exception type, as specified in cfcatch.","`cfcatch.message`: Message: Exception's diagnostic message, if provided; otherwise, an empty string; in the cfcatch.message variable.","`cfcatch.detail`: Detailed message from the CFML interpreter or specified in a cfthrow tag. When the exception is generated by ColdFusion (and not cfthrow), the message can contain HTML formatting and can help determine which tag threw the exception.","`cfcatch.tagcontext`: An array of tag context structures, each representing one level of the active tag context at the time of the exception.","`cfcatch.NativeErrorCode`: Applies to type = \"database\". Native error code associated with exception. Database drivers typically provide error codes to diagnose failing database operations. Default value is -1.","`cfcatch.SQLState`: Applies to type = \"database\". SQLState associated with exception. Database drivers typically provide error codes to help diagnose failing database operations. Default value is 1.","`cfcatch.Sql`: Applies to type = \"database\". The SQL statement sent to the data source.","`cfcatch.queryError`: Applies to type =\"database\". The error message as reported by the database driver.","`cfcatch.where`: Applies to type= \"database\". If the query uses the cfqueryparam tag, query parameter name-value pairs.","`cfcatch.ErrNumber`: Applies to type = \"expression\". Internal expression error number.","`cfcatch.MissingFileName`: Applies to type = \"missingInclude\". Name of file that could not be included.","`cfcatch.LockName`: Applies to type = \"lock\". Name of affected lock (if the lock is unnamed, the value is \"anonymous\").","`cfcatch.LockOperation`: Applies to type = \"lock\". Operation that failed (Timeout, Create Mutex, or Unknown).","`cfcatch.ErrorCode`: Applies to type = \"custom\". String error code.","`cfcatch.ExtendedInfo`: Applies to type = \"application\" and \"custom\". Custom error message; information that the default exception handler does not display."]}
],
"engines": {
"coldfusion": {"minimum_version":"4", "notes":"", "docs":"https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-c/cfcatch.html"},
"lucee": {"minimum_version":"", "notes":"", "docs":"https://docs.lucee.org/reference/tags/catch.html"},
"railo": {"minimum_version":"", "notes":"", "docs":"http://railodocs.org/index.cfm/tag/cfcatch"},
"openbd": {"minimum_version":"", "notes":"", "docs":"http://openbd.org/manual/?/tag/cfcatch"}
},
"links": [
],
"examples": [
{
"title": "A simple try/catch script based example",
"description":"Create a divide by zero error and then catch it.",
"code":"try {\n x = 5/0;\n}\ncatch (any e) {\n writeOutput(\"Error: \" & e.message);\n}",
"result":"Error: Division by zero."
},
{
"title": "A simple try/catch tag based example",
"description":"Create a divide by zero error and then catch it.",
"code":"<cftry>\n <cfset x = 5/0 />\n <cfcatch type=\"any\">\n Error: <cfoutput>#cfcatch.message#</cfoutput>\n </cfcatch>\n</cftry>",
"result":"Error: Division by zero."
}
]
}