RE: cfthrow from onRequestStart / flashagteway
Thanks for that. I had hoped I could throw the exception back to Flash like it can be done from methods in other components :( I'm trying to make use of onError but I'm not sure it fits. How does this sound: I implemented onError, which now fires when I cfthrow from inside onRequestStart. In onError I can't detect anything about the error I threw because the error caught is the same Event Handler Exception. I can cfthrow from onError which will return an error to the Flash client, but I want to be able to throw specific errors like 'not logged in' (which is enforced in onRequestStart). -Original Message- From: Michael Dinowitz [mailto:[EMAIL PROTECTED] Sent: Tuesday, 27 June 2006 2:22 AM To: CF-Talk Subject: Re: cfthrow from onRequestStart / flashagteway A CFThrow tosses an error up to the parent of a template. An application.cfc in some ways acts as the parent of the template but if you do a CFThrow inside of it when using a gateway, there's nowhere for the error to go other than the global error handler. Better to call the onError method within the application.cfc than use a CFThrow. Hi would anyone know why I cant use CFTHROW from within Application CFC onRequestStart()? I am calling a CFC from Flash via the flashgateway. If I cfthrow I get 06/26 23:07:37 Error [jrpp-3] - Event Handler Exception. in Coldfusion. Im stumped. Thanks. -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.9.4/375 - Release Date: 25/06/2006 ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:244852 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
cfthrow from onRequestStart / flashagteway
Hi would anyone know why I cant use CFTHROW from within Application CFC onRequestStart()? I am calling a CFC from Flash via the flashgateway. If I cfthrow I get 06/26 23:07:37 Error [jrpp-3] - Event Handler Exception. in Coldfusion. Im stumped. Thanks. -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.9.4/375 - Release Date: 25/06/2006 ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:244774 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: cfthrow from onRequestStart / flashagteway
A CFThrow tosses an error up to the parent of a template. An application.cfc in some ways acts as the parent of the template but if you do a CFThrow inside of it when using a gateway, there's nowhere for the error to go other than the global error handler. Better to call the onError method within the application.cfc than use a CFThrow. Hi would anyone know why I cant use CFTHROW from within Application CFC onRequestStart()? I am calling a CFC from Flash via the flashgateway. If I cfthrow I get 06/26 23:07:37 Error [jrpp-3] - Event Handler Exception. in Coldfusion. Im stumped. Thanks. -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.9.4/375 - Release Date: 25/06/2006 ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:244783 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: cfscript equivalent for cfthrow
Oleg, We have a set of user-defined functions that mimic CF functions not available in CFScript that we include in many of our applications. For example, we define throw(), throwType(), and rethrow(): cffunction name=Throw returntype=void output=no access=public cfargument name=Message type=string required=false default= cfthrow message=#Arguments.Message# /cffunction cffunction name=ThrowType returntype=void output=no access=public cfargument name=ExceptionType type=string required=true cfargument name=Message type=string required=false default= cfthrow type=#Arguments.ExceptionType# message=#Arguments.Message# /cffunction cffunction name=Rethrow returntype=void output=no access=public cfargument name=Exception required=true cfthrow object=#Arguments.Exception# /cffunction Jon On 3/29/06, Oleg Gunkin [EMAIL PROTECTED] wrote: What's the equivalent to cfthrow inside cfscript? try{ ... }catch(Any e){ //Throw new exception } -- Oleg Gunkin Email: [EMAIL PROTECTED] Phone: (604) 666-9392 Emerging Technologies / Pacific Web Services Information Technology Services Public Works and Government Services Canada (Pacific) ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:236613 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
cfscript equivalent for cfthrow
What's the equivalent to cfthrow inside cfscript? try{ ... }catch(Any e){ //Throw new exception } -- Oleg Gunkin Email: [EMAIL PROTECTED] Phone: (604) 666-9392 Emerging Technologies / Pacific Web Services Information Technology Services Public Works and Government Services Canada (Pacific) ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:236507 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: cfscript equivalent for cfthrow
What's the equivalent to cfthrow inside cfscript? try{ ... }catch(Any e){ //Throw new exception } It's exactly that - try and catch: http://livedocs.macromedia.com/coldfusion/7/htmldocs/0978.htm#1161053 Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:236509 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
cfthrow/cferror require session management?
I was writing some form validation and using cfthrow to throw validation errors to a exception handling page defined with cferror. But instead of getting details about my error, I was getting a something about session not being defined on line 4. Well, session surly was not defined; I wasn't using it in this application and had not turned on session management. This had me mightily confused until I decided what the heck, turn on session management. I added a cfapplication tag to my application.cfm file and turned on session management. Ta da, that fixed it. So did I miss in the documentation somewhere that to use cfthrow and/or cferror session management must be turned on? CFMX 6.1 by the way. -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA C code. C code run. Run code run. Please! - Cynthia Dunning Confidentiality Notice: This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:210427 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
How to use cferror and cfthrow
How would one allow an custom error created with a cfthrow be thrown to a error handling page indicated with cferror? -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA C code. C code run. Run code run. Please! - Cynthia Dunning Confidentiality Notice: This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:202052 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: How to use cferror and cfthrow
Ok, type=exception is what I wanted. So the question is, is there a way to use the same error handling template for validation errors and exception errors, or do I just want to create separate, but similar files? -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA C code. C code run. Run code run. Please! - Cynthia Dunning -Original Message- From: Ian Skinner Sent: Friday, April 08, 2005 3:20 PM To: CF-Talk Subject: How to use cferror and cfthrow How would one allow an custom error created with a cfthrow be thrown to a error handling page indicated with cferror? -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA C code. C code run. Run code run. Please! - Cynthia Dunning Confidentiality Notice: This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:202053 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Passing CFTHROW errorcode to CFERROR Template
that's rather strange... iirc the error generated in the template specified by cferror should be identical to any error that would be generated by cfthrow-cfcatch. You might rewrite it temporarily with throw-catch to test and see what results you get. It seems I can't pass a CFTHROW errorCode back to a CFERROR Template. I do not get an error just no value also type comes back as coldfusion.runtime.CfErrorWrapper The CFERROR is a site wide error handler so errorcodes could be different, but template is same. Outside of having rewrite using CFCATCH, is there a way I can get the information I need (errorcode). Thanks Kevin [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Passing CFTHROW errorcode to CFERROR Template
It seems I can't pass a CFTHROW errorCode back to a CFERROR Template. I do not get an error just no value also type comes back as coldfusion.runtime.CfErrorWrapper The CFERROR is a site wide error handler so errorcodes could be different, but template is same. Outside of having rewrite using CFCATCH, is there a way I can get the information I need (errorcode). Thanks Kevin [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
CFTHROW in a CFC/Webservice
If you use CFTHROW within CFC that is invoked via a webservice, the default error returned is an Application/Axis fault. Is there any way to return just the native error type/information thrown in the CFC without the Axis wrapper? How have others worked around this? Thanks, -- Alex Sherwood PHS Collection Agency THE COLLECTORS T:301.215.4200 F:301.664.6834 W: www.phs-net.com [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Display calling page code in error screen after cfthrow, not custom tag code
I'm writing a custom tag that validates attribute values and if a value isn't valid it throws an error message consistent with CF's internal messages, like this: cfset tagName=listGetAt( getFileFromPath( getCurrentTemplatePath()),1,.) cfset det = The value of the attribute QUERY is invalid. The value must be a reference to a query or the name of a query that exists in VARIABLES scope. cfset e = createObject( java, coldfusion.tagext.validation. IllegalAttributeValueException) cfset e.init(tagName, QUERY, det) cfthrow object=#e# But when the error is thrown CF displays the custom tag code as the location of the error, like this: Attribute validation error for tag DISPLAYINCOLUMNS. The value of the attribute COLUMNS is invalid. The value of the attribute COLUMNS is invalid. The value must be an integer greater than or equal to one. The error occurred in C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\Inventory2004\Input\CustomT ags\DisplayInColumns.cfm: line 108 106 : coldfusion.tagext.validation. 107 : IllegalAttributeValueException) 108 :cfset e.init(tagName, COLUMNS, det) 109 :cfthrow object=#e# 110 : Is there a way to get CF to display the error as if it occurred in the calling page, on the line that called the custom tag? I tried cfencode, but that just hides the code. Thanks, Sam -- Blog: http://www.rewindlife.com Chart: http://www.blinex.com/products/charting -- ~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137983 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
CFTHROW with Webservices
When using CFTHROW with Web Services, is there a way to trim down the error message returned? When called as a component, the cfcatch.detail and cfcatch.message are fine, but when called as a web service, they are loaded with AXIS fault codes, etc. How has anyone else handled this? Thanks! -- Alex Sherwood PHS Collection Agency THE COLLECTORS 301.215.4200 T 301.664.6834 F www.phs-net.com ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
Re: CFTHROW with Webservices
On Wednesday, Nov 13, 2002, at 10:57 US/Pacific, Alexander Sherwood wrote: When using CFTHROW with Web Services, is there a way to trim down the error message returned? When called as a component, the cfcatch.detail and cfcatch.message are fine, but when called as a web service, they are loaded with AXIS fault codes, etc. How has anyone else handled this? Ugly, isn't it? My team decided to not throw exceptions out of the Web Service and instead return a struct with the first element indicating success / failure and the second element being either the result (for success) or the CF exception details (for failure). That means that all our Web Service methods look like: cffunction name=foo ... ...args... cfset returnValue = structNew()/ cfset returnValue.success = true/ cftry ... do a bunch of stuff ... cfset returnValue.result = whatever/ cfcatch type=any cfset returnValue.success = false/ cfset returnValue.result = structNew()/ cfset returnValue.result.message = cfcatch.message/ !--- etc --- /cfcatch /cftry cfreturn returnValue/ /cffunction Sean A Corfield -- Director, Architecture Web Technology Group -- Macromedia, Inc. tel: (415) 252-2287 -- cell: (415) 717-8473 aim: seancorfield -- http://www.macromedia.com An Architect's View -- http://www.corfield.org/blog/ Introducing Macromedia Contribute. Web publishing for everyone. Learn more at http://www.macromedia.com/contribute ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm
Re: CFTHROW with Webservices
At 11:24 AM 11/13/2002 -0800, you wrote: I debated on whether or not to adopt this methodology (structure-based return variables), but decided to go with the cftry/catch. Might have to rethink this now. Thanks for the insight. On Wednesday, Nov 13, 2002, at 10:57 US/Pacific, Alexander Sherwood wrote: When using CFTHROW with Web Services, is there a way to trim down the error message returned? When called as a component, the cfcatch.detail and cfcatch.message are fine, but when called as a web service, they are loaded with AXIS fault codes, etc. How has anyone else handled this? Ugly, isn't it? My team decided to not throw exceptions out of the Web Service and instead return a struct with the first element indicating success / failure and the second element being either the result (for success) or the CF exception details (for failure). That means that all our Web Service methods look like: cffunction name=foo ... ...args... cfset returnValue = structNew()/ cfset returnValue.success = true/ cftry ... do a bunch of stuff ... cfset returnValue.result = whatever/ cfcatch type=any cfset returnValue.success = false/ cfset returnValue.result = structNew()/ cfset returnValue.result.message = cfcatch.message/ !--- etc --- /cfcatch /cftry cfreturn returnValue/ /cffunction Sean A Corfield -- Director, Architecture Web Technology Group -- Macromedia, Inc. tel: (415) 252-2287 -- cell: (415) 717-8473 aim: seancorfield -- http://www.macromedia.com An Architect's View -- http://www.corfield.org/blog/ Introducing Macromedia Contribute. Web publishing for everyone. Learn more at http://www.macromedia.com/contribute ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm
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 formfield 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 __ Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://wwwpennyhostcom/redirectcfm?adcode=coldfusiona FAQ: http://wwwthenetprofitscouk/coldfusion/faq Archives: http://wwwmail-archivecom/cf-talk@houseoffusioncom/ Unsubscribe: http://wwwhouseoffusioncom/indexcfm?sidebar=lists
RE: Custom error (cfthrow) question
when you trap an error of type database, you're provided with SQLState and NativeErrorCode. examine these with your CATCH, then do what you like with the user. christopher olive, cto, vp of web development, vp it security atnet solutions, inc. 410.931.4092 http://www.atnetsolutions.com -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. __ 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=coldfusiona 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
Re: Custom error (cfthrow) question
We do something like this, but instead of notifying the user, we update the field size and re-attempt the insert Note: This under controlled circumstances and is not done in an Adhoc, lets just make it bigger fashion Just look in your log (or a SQL book) to find the error codes and add clauses to a cfswitch statement for various odbcerrors !- catch code --- cftry !--- insert goes here --- cfcatch !--- catch various SQL error and attempt to fix them and re-run the insert --- cfswitch expression=#trim(cfcatchsqlstate)# cfcase value=22001 !--- data is being truncated, do something here --- /cfcase cfcase value=S0002 !--- missing table, do something here --- /cfcase /cfswitch /cfcatch /cftry Brook Davies maracasmediacom At 12:03 PM 28/02/02 -0800, you wrote: 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 formfield 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 __ Why Share? Dedicated Win 2000 Server · PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://wwwpennyhostcom/redirectcfm?adcode=coldfusionc FAQ: http://wwwthenetprofitscouk/coldfusion/faq Archives: http://wwwmail-archivecom/cf-talk@houseoffusioncom/ Unsubscribe: http://wwwhouseoffusioncom/indexcfm?sidebar=lists
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. __ 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=coldfusiona 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
RE: Custom error (cfthrow) question
Thanks all for the help! H. -Original Message- From: Christopher Olive [SMTP:[EMAIL PROTECTED]] Sent: Thursday, February 28, 2002 12:18 PM To: CF-Talk Subject: RE: Custom error (cfthrow) question when you trap an error of type database, you're provided with SQLState and NativeErrorCode. examine these with your CATCH, then do what you like with the user. christopher olive, cto, vp of web development, vp it security atnet solutions, inc. 410.931.4092 http://www.atnetsolutions.com -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. __ 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=coldfusiona 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
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. __ Why Share? Dedicated Win 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=coldfusionc 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
RE: Custom error (cfthrow) question
no, the TYPE is DATABASE. you use CFCATCH.NativeErrorCode in the catch statement to dump the error code. it's all in the help files under CFTRY CFCATCH (a nice way to tell you to try to RTFM :)) christopher olive, cto, vp of web development, vp it security atnet solutions, inc. 410.931.4092 http://www.atnetsolutions.com -Original Message- From: Owens, Howard [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 28, 2002 5: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. __ Why Share? Dedicated Win 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=coldfusionc 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
RE: Custom error (cfthrow) question
I tried the nativeerrorcode attribute and I get this error (on a 50 server): Just in time compilation error An unknown attribute 'NATIVEERRORCODE' has been encountered If you're using ODBC, you'll want to reference CFCATCHSQLState CFCATCHNativeErrorCode is for native drivers, I think Dave Watts, CTO, Fig Leaf Software http://wwwfigleafcom/ voice: (202) 797-5496 fax: (202) 797-5444 __ Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://wwwpennyhostcom/redirectcfm?adcode=coldfusiona FAQ: http://wwwthenetprofitscouk/coldfusion/faq Archives: http://wwwmail-archivecom/cf-talk@houseoffusioncom/ Unsubscribe: http://wwwhouseoffusioncom/indexcfm?sidebar=lists
RE: Custom error (cfthrow) question
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
CFTHROW
How Do I define my own error in a cfthrow? I would like to say if the error is an invalid search criteria then Thanks, ---miriam -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebarRstsbodyRsts/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: CFTHROW
Miriam Hirschman wrote: How Do I define my own error in a cfthrow? I would like to say if the error is an invalid search criteria then Try something like this: CFTRY CFIF SearchCriteria IS Invalid CFTHROW TYPE="MyCustomError" MESSAGE="Your Search Criteria are Invalid" /CFIF CFCATCH TYPE="MyCustomError" #CFCATCH.Message# /CFCATCH /CFTRY Basically the idea is to wrap the CFTHROW in conditional code so that it creates an error when certain conditions are met. You then "catch" the error by referring to it with the TYPE parameter using CFCATCH, and display the defined error message using CFCATCH.Message (and CFCATCH.Detail, if you define that as well). Gene Kraybill -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.