Hey Matt, 

I think that's pretty much what you get ... However, if you need to be able to get to 
it frequently, I'd create a UDF to traverse the cfcatch structure, 'cause that [2] 
isn't always 2 ... 

Because some cf errors don't produce any information about where the error is found, I 
created an errFormat() function for my own project(s) which checks for the existance 
of elements in the tagcontext array (it's empty if you leave trace off in the admin) 
and if they exist, adds the info from the last element in the array to the error 
message and detail info -- in most cases I'm actually storing these errors in the db 
during a batch process, but you get the idea. :) 

hth 

Isaac 

p.s. My ISP is going out of business and I haven't been able to get my machine online 
yesterday or today, so i'm sending from a hideous webmail interface. ;P and hoping to 
have a new broadband provider soon. :) 

Original Message -----------------------
Is there a way under cfmx to retrieve the name of the template that
calls a custom tag? I've tried this, which works although it seems
inelegant.

<cftry>
        <cfthrow>
        <cfcatch>
                <cfif arrayLen(cfcatch.tagcontext) gt 1>
                        <cfset parentTemplate =
cfcatch.tagcontext[2].template>
                <cfelse>
                        <cfset parentTemplate = "">
                </cfif>
        </cfcatch>
</cftry>

<cfoutput>The template that called this tag was:
#parentTemplate#</cfoutput>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

Reply via email to