Page 1 of 1
How to handle attempt to set non-existent configuration?
Posted: Sun Sep 03, 2006 9:47 pm
by Ambush Commander
How should a library handle an attempt to set a non-existent configuration directive?
On one hand, if it doesn't exist, you probably ought to tell the user right away. Maybe it's a typo or something.
On the other hand, a lot of software packages don't complain when a non-existent value is set. The say "Oh, maybe it's used in a future/past version, no problem-o!" PHP, for example.
Right now, I'm fatally error'ing out. What do you think I should do?
Posted: Sun Sep 03, 2006 9:51 pm
by feyd
Built properly, this system is fairly future proof and therefore should know which directives are correct. So erroring out immediately (or so some catching system) would likely be the best course.
If in development mode it could even try to suggest the correct directive.
Posted: Mon Sep 04, 2006 10:46 am
by Jenk
for "non-existant" stuff, perhaps a notification and continue as per norm, ignoring it? ala Notice errors in php.. or perhaps warning level (Warning: config option blah ignored. continuing normal operations..)
Posted: Mon Sep 04, 2006 12:14 pm
by Ambush Commander
Well, therein lies the problem. Notices are usually ignored... not everyone even has them turned on. Warnings are a bit better, but they're not as in your face as a fatal error.
I'm pretty sure I know what my options are, so I'm more interested in rationale behind making the error fatal or not.
Posted: Mon Sep 04, 2006 12:27 pm
by feyd
This choice seems like it may narrow down to "who is my audience?" If the answer is other (decently) experienced developers, then fatals sound fine. If on the other hand this is a drop-in or intended for complete novices then I'd sway toward swallowing the error while still firing a warning or notice.
Posted: Mon Sep 04, 2006 12:30 pm
by Ambush Commander
Well, since the documentation around configuration is near non-existent, I think I'll opt for the advanced developer audience for now, and then bump it down once I officially release the functionality. Thanks Feyd!
Posted: Mon Sep 04, 2006 6:59 pm
by Jenk
They don't have to be E_USER_NOTICE/WARNING.. you can generate your own error that can't be simply switched off with display_errors()
Posted: Mon Sep 04, 2006 7:05 pm
by Ollie Saunders
Ability for user to set with default as fatal?
Code: Select all
DirectivesControlClass::setExistanceFailureHandleMethod(DirectivesControlClass::FATAL);
DirectivesControlClass::setExistanceFailureHandleMethod(DirectivesControlClass::NOTICE);
DirectivesControlClass::setExistanceFailureHandleMethod(DirectivesControlClass::IGNORE);
You might wanna use a shorter function name
