|Syntactic Confectionery Delight|
Re: Error handling - how much?by Ultra (Hermit)
|on Jun 12, 2005 at 19:55 UTC||Need Help??|
I can only agree with salva. Wrapping every sentence in eval will not only slow down your entire program, but it will obfuscate it to the point of no return.
Instead, I think it's more useful to be aware of certain situations prone to generating errors.
Here's an incomplete list:
* use strict and warnings for typos and common mistakes
* check the user's input using regular expressions (taint check is a big helper here)
* be careful about arithmetic operations (divide by zero etc.)
* check the return of the system calls and generally the retun values of all the functions you use (including yours), and when you can't continue, throw a useful message so that the user can easily spot the problem and eventualy contact you if it is the case...
I don't think it's a matter of "how much" but of "when and how" to check for possible errors.