P is for Practical | |
PerlMonks |
Re: Error handlingby GrandFather (Saint) |
on Sep 17, 2012 at 22:14 UTC ( [id://994130]=note: print w/replies, xml ) | Need Help?? |
If your error messages are as shown keep them to a minimum. They don't help the maintainer because they don't describe the details of the problem and they don't help the user because they don't describe how to avoid the problem. Decide who the error messages are for and make sure they provide the best possible information for the audience. For a user that means describing the nature of the problem and how to fix it. For a maintainer that means describing as much of the pertinent context as possible so further debugging sessions are less likely to be needed to diagnose the problem. User error messages are likely to be confined to areas of the code validating input. Maintenance error messages are likely to be sprinkled through the rest of the code as a sanity check and in place of a comment describing the expected outcome of steps. A test and die that checks an outcome is both documentation and sanity checking.
True laziness is hard work
In Section
Seekers of Perl Wisdom
|
|