Lets see if this one can start a global cf war..
I had this idea/thought and like always its probably a stupid one, so I thought lets post it to the list and see what all the real experts have to say about it.
I want more control on what happens when there is an error, for example I want to have a choice when I output something like #insignicantVariable# to display
[Error] to the user, nothing or fail.
#obj.fnOutput( variables, 'firstName', 'fail' )#
Now tell me, how stupid is this and why?
<cfcomponent displayname="Output"
hint="">
<!--- ***************** Function ***************** --->
<cffunction access="public"
name="fnOutput"
output="true"
returntype="void"
displayname=""
hint="">
<cfargument name="scope"
type="struct"
required="true"
displayname="Scope">
<cfargument name="identifier"
type="string"
required="true"
default="variables"
displayname="Scope">
<cfargument name="onError"
type="string"
required="true"
default="display"
displayname="On Error">
<cftry>
#arguments.scope[ arguments.identifier ]#
<cfcatch type="any">
<cfswitch _expression_="#arguments.onError#">
<cfcase value="display">
[Error]
</cfcase>
<cfcase value="nothing"></cfcase>
<cfcase value="fail">
<cfthrow message="#cfcatch.message#"
type="Custom"
detail="#cfcatch.detail#">
</cfcase>
<cfdefaultcase><!--- This should never happen ---></cfdefaultcase>
</cfswitch>
</cfcatch>
</cftry>
</cffunction>
</cfcomponent>
---You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
Register now for the 3rd National Conference on Tourism Futures, being held in Townsville, North Queensland 4-7 August - www.tq.com.au/tfconf |
