customize cfcatch
Oct 21
Customize cfcatch in Coldfusion is kinda incredible. We can define our own customize "error exception". I believe, it's one of the advantages of using Coldfusion Developer. That's why I love Coldfusion. Customize "error exception" is very simple. We need to integrate following three tags cfthrow, cftry and cfcatch. First of all, we need to define custom type with cfthrow like following.
2 Useful Information
3 ==================
4 type = [your exception name]
5 errorcode = [your error code]
6 message = [the message you want to display]
7--->
8<cfthrow type="myexp" errorcode="ERROR-007" message="Oh my god..!! I've been caught.">
Here is how to catch your exception If your application hits to this exception, it will be display error message and error code as you defined.
2 <cfoutput>
3 #cfcatch.message#
4 #cfcatch.errorcode#
5 </cfoutput>
6</cfcatch>
Here is full simple coding
2 ....
3 ....
4 ....
5 ....
6 ....
7 ....
8
9
10 <cfthrow type="myexp" errorcode="ERROR-007" message="Oh my god..!! I have been caught.">
11 <cfcatch type="myexp">
12 <cfoutput>
13 #cfcatch.message#
14 #cfcatch.errorcode#
15 </cfoutput>
16 </cfcatch>
17</cftry>

Android
Top of Page