Thanks Gary, I totally read the question the wrong way.  Looking back,
before you do the CFRETURN, you should probably be checking that there is a
foriegn key to return.  If there isn't, throw a meaningful error message
with CFTHROW, and catch that instead of trying to deal with the generic
message CF throws for you.

I do this for business objects.  Everything CFC has a getId() method
(inherited), which returns the primary key of the main record persisting the
object's data.  If an object is initialized as new (unpersisted), after it
has been deleted, or initialized with a non-existant ID, calling getId()
throws an exception, which I catch and react accordingly (usually with an
"invalid ID specified" message).

cheers,
barneyb

---
Barney Boisvert, Senior Development Engineer
AudienceCentral
[EMAIL PROTECTED]
voice : 360.756.8080 x12
fax   : 360.647.5351

www.audiencecentral.com


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of Gary Menzel
> Sent: Monday, July 21, 2003 3:41 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [CFCDev] Argument Type Error
>
>
> > You should be checking that whatever you're passing to the function is
> valid
> > before you pass it (likely using isNumeric()).  The error is generated
> to
> > make sure execution doens't proceed, not to help you catch validation
> > errors.
>
> Or returning....
>
> If you can't ensure the type then return ANY instead of NUMERIC.  As
> Barney said, you really shouldn't use exception handling for data
> validation (but you can).  The "validation" is actually already happening
> and giving you a runtime error (because you told it the value must be
> numeric).  Therefore, there is either something wrong with the value or
> something wrong with saying it should be NUMERIC.
>
> Make sense?
>
> Gary Menzel
> IT Operations Brisbane -+- ABN AMRO Morgans Limited
> Level 29, 123 Eagle Street BRISBANE QLD 4000
> PH: 07 333 44 828  FX:  07 3834 0828
>
> [EMAIL PROTECTED] wrote on 07/22/2003 06:44:57 AM:
>
> > You should be checking that whatever you're passing to the function is
> valid
> > before you pass it (likely using isNumeric()).  The error is generated
> to
> > make sure execution doens't proceed, not to help you catch validation
> > errors.
> >
> > That being said, you could wrap the method call with a CFTRY block, but
> > you'd have to do it for _every_ call, which would be very messy
> at best.
>  Or
> > you could use a global exception handler and redirect to an error page,
> but
> > that'd be fairly useless except to hide the specifics of the problem
> from
> > the user.
> >
> > barneyb
> >
> > ---
> > Barney Boisvert, Senior Development Engineer
> > AudienceCentral
> > [EMAIL PROTECTED]
> > voice : 360.756.8080 x12
> > fax   : 360.647.5351
> >
> > www.audiencecentral.com
> >
> >
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > > Behalf Of Justin Balog
> > > Sent: Monday, July 21, 2003 12:45 PM
> > > To: '[EMAIL PROTECTED]'
> > > Subject: [CFCDev] Argument Type Error
> > >
> > >
> > >
> > > Is there a way to catch an "Argument Type Error"?  This is the
> > > error that I
> > > get---
> > >
> > > The value returned from function
> getcClerkBusinessOwnershipTypeFK() is
> not
> > > of type numeric.
> > >
> > > Here is the function:
> > >
> > > <CFFUNCTION access="private" name="getcClerkBusinessOwnershipTypeFK"
> > > returntype="numeric" output="false" displayname="Get Business
> > > Ownership Type
> > > Method" hint="I Get the Business Ownership Types of the account">
> > >    <CFRETURN instance.cClerkBusinessOwnershipTypeFK>
> > > </CFFUNCTION>
> > >
> > > Here is the call to the function:
> > >
> > > myResultStruct.cClerkBusinessOwnershipTypeFK =
> > > getcClerkBusinessOwnershipTypeFK();
> > >
> > > I was just curious where I should put my error handling
> > > (Try/Catch) in order
> > > to capture the error that occurs?
> > >
> > > Thanks,
> > >
> > > Justin
> > > ----------------------------------------------------------
> > > You are subscribed to cfcdev. To unsubscribe, send an email
> > > to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
> > > in the message of the email.
> > >
> > > CFCDev is run by CFCZone (www.cfczone.org) and supported
> > > by Mindtool, Corporation (www.mindtool.com).
> > >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/2003
> >
> > ----------------------------------------------------------
> > You are subscribed to cfcdev. To unsubscribe, send an email
> > to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
> > in the message of the email.
> >
> > CFCDev is run by CFCZone (www.cfczone.org) and supported
> > by Mindtool, Corporation (www.mindtool.com).
>
> ******************************************************************
> **********
> If this communication is not intended for you and you are not an
> authorised
> recipient of this email you are prohibited by law from dealing with or
> relying on the email or any file attachments. This prohibition includes
> reading, printing, copying, re-transmitting, disseminating, storing or in
> any other way dealing or acting in reliance on the information.  If you
> have received this email in error, we request you contact ABN AMRO Morgans
> Limited immediately by returning the email to [EMAIL PROTECTED]
> and destroy the original. We will refund any reasonable costs associated
> with notifying ABN AMRO Morgans. This email is confidential and
> may contain
> privileged client information. ABN AMRO Morgans has taken reasonable steps
> to ensure the accuracy and integrity of all its communications, including
> electronic communications, but accepts no liability for materials
> transmitted. Materials may also be transmitted without the
> knowledge of ABN
> AMRO Morgans.  ABN AMRO Morgans Limited its directors and employees do not
> accept liability for the results of any actions taken or not on the basis
> of the information in this report. ABN AMRO Morgans Limited and its
> associates hold or may hold securities in the companies/trusts mentioned
> herein.  Any recommendation is made on the basis of our research of the
> investment and may not suit the specific requirements of clients.
> Assessments of suitability to an individual's portfolio can only be made
> after an examination of the particular client's investments, financial
> circumstances and requirements.
> ******************************************************************
> **********
>
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
> in the message of the email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/2003

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

Reply via email to