Copy link to clipboard
Copied
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.. ?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Take a look at the Application.cfc reference in the docs, it's all in there.
Copy link to clipboard
Copied
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 ?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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/
Copy link to clipboard
Copied
thanks Dave
All sorted
Find more inspiration, events, and resources on the new Adobe Community
Explore Now