Raymond,

I still think we're not quite on the same level here. That or my MX is 
acting weird. I do indeed get the context, but it still comes from the 
<cfthrow>, not the Throw() function.

Try the following component and just call test() without any exception 
handling around it:

<cfcomponent output="true" >
        <cffunction name="test">
                <cftry>
                        <cfquery datasource="doesntmatter">
                                SELECT * FROM table WHERE 1
                        </cfquery>
                        <cfcatch>
                                Exception thrown...
                                <cfset ThrowObj(cfcatch)/>
                        </cfcatch>
                </cftry>                
        </cffunction>
        
        <cffunction name="ThrowObj" output="false" returntype="void">
                <cfargument name="object" required="true"/>
                <cfset object.RootCause.Message = object.RootCause.Message & "This is 
a test!"/>
                <cfset object.Message = object.Message & "This is a test!"/>

                <cfthrow object="#object#"/>
        </cffunction>
</cfcomponent>

Notice that the error message is centered around the <cfquery>, not the 
ThrowObj() function. Also note that the message displayed has not been 
changed, despite the fact that I <cfset> object.RootCause.Message and 
object.Message. It is this object I wish to modify while retaining the 
context.

Raymond Camden wrote:

> Just an FYI, when I cfthrow from the CFC, if I use try/catch in my
> caller, I _can_ see tagcontext. Here is my cfc:
> 
> <cfcomponent output="true" >
> 
> 
>       <cffunction name="test">
>               
>               <cfset throw("Test one")>
>               <cfreturn now()>
>               
>       </cffunction>
>       
>       <cffunction name="throw" output="false" returnType="void"
> access="private">
>               <cfargument name="msg" type="string" required="true">
>               <cfthrow message="#msg#">
>       </cffunction>
> 
> </cfcomponent>
> 
> Here is my caller: 
> 
> <cftry>
> <cfinvoke component="alpha" method="test">
> <cfcatch>
>       <cfdump var="#cfcatch#">
> </cfcatch>
> </cftry>
> 
> cfcatch.tagcontext correctly shows line #2 generated the error.
> 


-- 
  Oliver Tupman
  Key Systems Geotechnical

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to