Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

detect any error with website and dislay my own "error.cfm" page

Participant ,
Mar 21, 2011 Mar 21, 2011

Is there a unified way of dealing with any type of error eg. page not found, database related error, and throwing up my own custom error page which simply says "sorry for inconvenience" , etc.. ?

TOPICS
Getting started
826
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 21, 2011 Mar 21, 2011

Yep.

Have a look @ the online docs, and within the "Developing CF Applications" section, there's a subsection "Handling Errors".

http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7fc4.html

Did you check the docs before asking the question?

--

Adam

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 21, 2011 Mar 21, 2011

Take a look at the Application.cfc reference in the docs, it's all in there.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 21, 2011 Mar 21, 2011

Looking at help.adobe.com it mentions

<cfferror  
    template = "template path" 
    type = "exception|validation|request" 
    exception = "exception type" 
    mailTo = "e-mail address">

just to confirm, if I set type = "request" will it catch BOTH exceptions AND validation errors ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 21, 2011 Mar 21, 2011

Come on mate: try to help yourself occasionally.

What does it say further down the very page you're looking at (which I presume is http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7d29.html):

request: any encountered error.

What does that suggest to you?  I'm not sure there's any more than one way of reading that.

Equally... it wouldn't have taken you very long to actually put this to the test would it?

--

Adam

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 21, 2011 Mar 21, 2011

1) I did read it, and thought, did they mean any encountered errors in the context of "request", not knowing fully the scope of "request"

2) Nope, can't test it as I'm not near a server

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 21, 2011 Mar 21, 2011

Offhand, I don't think it does. Validation errors are not "unrecoverable". If you want to catch errors thrown by CFFORM validation, I think you'll have to use TYPE="VALIDATION" for that.

You can certainly specify multiple error handlers with CFERROR, though:

<cferror type="request" ...>

<cferror type="validation" ...>

If all you're trying to do is capture errors without doing anything with them, that approach is adequate I guess. But really, you might want to look at a more structured way of handling errors, and you might want to use onError in Application.cfc instead of CFERROR in Application.cfm.

Dave Watts, CTO, Fig Leaf Software

http://www.figleaf.com/

http://training.figleaf.com/

Dave Watts, Eidolon LLC
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 21, 2011 Mar 21, 2011
LATEST

thanks Dave

All sorted

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources