>- see footer for list info -<
I'm starting to use cftry/cfthrow/cfcatch and am finding that custom types 
aren't being caught. Am I doing this right?


<cftry>
        <cfset avg_sales = getAverageSales()>

        <cfcatch type="my.custom.exception">No average value was 
returned</cfcatch>
</cftry>



<cffunction name="getAverageSales" returntype="numeric" output="false">
        <cfquery name="q" ...>
                select avg(some_col) as average_sales
                from table
                where ...
        </cfquery>

        <cfif not q.recordCount>
                <cfthrow type="my.custom.exception" message="no data to 
average" detail="...">
        </cfif>
        
        <cfreturn q.average_sales>
</cffunction>


The page is displaying "The value returned from function getAverageDailySales() 
is not of type numeric", which was what I was trying to trap with the cfthrow 
and the custom type.

If I change the cfcatch to type="any", the exception is caught and the "No 
average value..." message is output.

What gives?


Thanks

-- 
Aidan Whitehall
Macromedia ColdFusion Developer

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to