I don't believe you can modify the exception object like that. I think
you would need to use the proper methods to update the values.

See my last email. Can't you use the standard attributes of cfthrow to
pass a lot of detail back?

I ran your code and I still get the right results. My cfcatch.tagCOntext
shows that the cfquery tag on line 4 threw the error.

========================================================================
===
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
(www.mindseye.com)
Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia)

Email    : [EMAIL PROTECTED]
Blog     : www.camdenfamily.com/morpheus/blog
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda 

> -----Original Message-----
> From: Oliver Tupman [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, July 23, 2003 9:45 AM
> To: CF-Talk
> Subject: Re: Throwing exceptions from CFCs
> 
> 
> 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

Get the mailserver that powers this list at 
http://www.coolfusion.com

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

Reply via email to