User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ColdFusion section within the Web Development category of DaniWeb, a massive community of 427,194 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,147 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ColdFusion advertiser: Programming Forums
Views: 1051 | Replies: 4 | Solved
Reply
Join Date: Apr 2007
Posts: 28
Reputation: lafalot is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
lafalot lafalot is offline Offline
Light Poster

Catching Attribute Validation Errors

  #1  
Jan 4th, 2008
Hi,

I have a cferror type = "exception" exception="any" in my application.cfm file. This works great for most errors, but I recently found that it is not working for attribute validation errors.

For example, if I misspell an attribute for the cfqueryparam tag, my custom error page is not called. Instead, I get the default error that shows the SQL in my query, which I don't want. Cftry/cfcatch didn't work, either.

I can't use the Site-wide Error Handler, because I'm on a hosted server and I'm not allowed to make any changes to the Coldfusion Administrator.

Any ideas?

Thank you.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2008
Posts: 35
Reputation: mellamokb is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 5
mellamokb mellamokb is offline Offline
Light Poster

Re: Catching Attribute Validation Errors

  #2  
Jan 4th, 2008
Instead, I get the default error that shows the SQL in my query, which I don't want. Cftry/cfcatch didn't work, either.

There are two different types of errors that can occur in a webpage: parsing / compile-time errors and run-time errors. If you misspell an attribute in the query, then the cf engine can already determine that the query is not going to work, so it doesn't try to execute the query and then die with an exception that the attribute was misspelled. It checks that ahead of time when it is parsing / compiling the page.

This works great for most errors, but I recently found that it is not working for attribute validation errors.

You must fix those types of errors at compile-time, i.e., try to compile all of your web pages and see what errors arise. Or at least view all of your pages once first before you publish them for the whole world to see, and you can catch those errors, because the error will show up every time the page is viewed, not just sometimes, if the error is a compile-time error. A run-time error only shows up in the situation that causes the exception, and it makes sense to catch those errors gracefully.

~ mellamokb
Reply With Quote  
Join Date: Jan 2008
Posts: 35
Reputation: mellamokb is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 5
mellamokb mellamokb is offline Offline
Light Poster

Re: Catching Attribute Validation Errors

  #3  
Jan 4th, 2008
More information can be found at:

http://livedocs.adobe.com/coldfusion...e=00000242.htm

DracTK said on Apr 12, 2007 at 9:11 AM :
What thekat is saying is that the CF template has to be compilable in order for errors that cferror can catch to occur. cferror is only for run time errors, doesn't work for compile time errors (which makes a lot of sense).
Runrocket said on Jul 9, 2007 at 8:12 AM :
What is interesting is that while CFERROR will not catch compile time errors like '<cfet x = 1 />', if you define a site wide error handler in CF Administrator, this error will get caught and the user will be redirected to your custom error template. The problem here is that this error template cannot be customized for a specific application, but will appear for all applications hosted on your stand alone server or JRun instance.

~ mellamokb
Reply With Quote  
Join Date: Apr 2007
Posts: 28
Reputation: lafalot is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
lafalot lafalot is offline Offline
Light Poster

Re: Catching Attribute Validation Errors

  #4  
Jan 5th, 2008
Thank you, mellamokb. That was helpful. I just wanted to make sure I was doing everything possible. I do always check before I publish a page, but I've inherited this site, and there are a lot of pages that I haven't worked on.

Thanks again!

-- Lafalot
Last edited by lafalot : Jan 5th, 2008 at 1:58 am.
Reply With Quote  
Join Date: Jan 2008
Posts: 35
Reputation: mellamokb is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 5
mellamokb mellamokb is offline Offline
Light Poster

Re: Catching Attribute Validation Errors

  #5  
Jan 5th, 2008
No problem. Glad to help!

~ mellamokb
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ColdFusion Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the ColdFusion Forum

All times are GMT -4. The time now is 10:18 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC