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?
How to handle attempt to set non-existent configuration?
Moderator: General Moderators
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA

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.
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
Ability for user to set with default as fatal?You might wanna use a shorter function name 
Code: Select all
DirectivesControlClass::setExistanceFailureHandleMethod(DirectivesControlClass::FATAL);
DirectivesControlClass::setExistanceFailureHandleMethod(DirectivesControlClass::NOTICE);
DirectivesControlClass::setExistanceFailureHandleMethod(DirectivesControlClass::IGNORE);