try scoping it with "CFCATCH.NativeErrorCode".... not sure if that will help
On the otherhand, if your CFCatch block is catching ALL errors, then you have to make sure it is a DATABASE type before you can check the value of NativeErrorCode, or SQLState. In my case, I make have a CFCatch block specifically for database types of errors. Hope that helps. Shawn Grover -----Original Message----- From: Owens, Howard [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 28, 2002 3:00 PM To: CF-Talk Subject: RE: Custom error (cfthrow) question I tried the "nativeerrorcode" attribute and I get this error (on a 5.0 server): Just in time compilation error An unknown attribute 'NATIVEERRORCODE' has been encountered at document position (171:27) to (171:41) while processing tag CFCATCH. This tag can only take the following attributes: * TYPE > -----Original Message----- > From: Fred Jambukeswaran [SMTP:[EMAIL PROTECTED]] > Sent: Thursday, February 28, 2002 12:19 PM > To: CF-Talk > Subject: RE: Custom error (cfthrow) question > > Lets say you wanted to throw a fieldmissing error > use cfthrow like: > <cfthrow type="fieldmissing" message="hey buddy fill in all the > fields" > detail="missing field: first_name"> > > Then you can catch it along with your database error as follows: > > <cftry> > <!--- code here ---> > > <cfcatch type="Database" NativeErrorCode ="22001"> > <!--- do database error processing here ---> > </cfcatch> > <cfcatch type="fieldmissing"> > <!--- do missing field error processing here ---> > </cfcatch> > </cftry> > > -----Original Message----- > From: Owens, Howard [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 28, 2002 3:03 PM > To: CF-Talk > Subject: Custom error (cfthrow) question > > > I've used CFTRY/CFCATCH before. But I've never been clear on exactly > how to > catch specific ODBC type of errors, to put up a custom error message. > > I want an error message for : ODBC Error Code = 22001 (String data > right > truncation) > > If that error comes up, as opposed to any other error, I want to be > able to > say, "Hey buddy, you're input field is too big -- trim it back") > > I've used CFTHROW to do something like <cfif form.field is "blah"> > throw > </cfif> .... but I'm not sure I can catch and ODBC error and throw a > custom > error -- can I? How would you handle this? > > H. > > ______________________________________________________________________ Get Your Own Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists