>>I think this thread was discussed before, and you can't get the 
variables
scope in onError or with cferror.

Exact, I was the one to asked the question.
However, I just found that the request scope is available from the 
CFERROR template.
For instance, this works:

<CFERROR TYPE="EXCEPTION" TEMPLATE="testError.cfm">
<!--- Create a query --->
<CFQUERY NAME="request.testQuery" DATASOURCE="FAFO">
  SELECT * from events
</CFQUERY>
<!--- Make an error --->
<CFSET test = request.testQuery.columnDoesntExist>

Then in testError.cfm:

<CFLOOP COLLECTION="#request#" ITEM="item">
<CFIF isQuery (request[item])>
  <CFOUTPUT>Query #item# has #request[item].recordCount# records</CFOUTPUT>
</CFIF>
</CFLOOP>

Having all queries in the request scope isn't so bad, but this would 
mean changing a lot
of references to columns in the code.

 >>You can use cfthrow to set specific messages so you know where the 
error is
coming from:

Yes, but that would also require modifying hundreds of queries in the code.

<cfif error causing condition 1>
    <cfsavecontent variable="query1">
       <cfdump var="#myquery#">
    </cfsavecontent>
    <cfthrow message="Code block 1 has failed because of error causing
condition 1. #query1#">
</cfif>

 >>This is not as robust as being able to use onError, but it does allow 
you to
do some dumping at the time of your error.

Considering the work it would imply, I think putting queries in the 
request scope could be a better solution.

-- 
_______________________________________
REUSE CODE! Use custom tags;
See http://www.contentbox.com/claude/customtags/tagstore.cfm
(Please send any spam to this address: [EMAIL PROTECTED])
Thanks.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280684
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to