Is that person wrong?
11 Most Common Mistakes with Error Handling
- Forgetting to handle errors
- Not checking data types
- Not checking formatting ("8005551212" or "800-555-1212" or "(800) 555-1212", etc.)
- Not checking/correcting string case where case matters ("Foo", "foo", or "FOO"?)
- Not trimming string input before Boolean operations (does "FOO " = "FOO" ?)
- Not controlling the UI (checkbox, radio buttons, lists, instead of text boxes)
- Not checking for specific error type following an exception
- Building error PREVENTION into the UI
- Documenting your code (especially in places where exceptions are most likely to occur)
- Using outdated error handling (if your language supports Try/Catch/Fail, etc. use it!)
- Forgetting to manage exit codes (raising errors)
The answer to the question above is "No", but they should still be smacked in the face just for being obnoxious.
No comments:
Post a Comment