- Handle problems at the appropriate level. (Avoid catching exceptions unless you know what to do with them).
- Fix the problem and call the method that caused the exception again.
- Patch things up and continue without retrying the method.
- Calculate some alternative result instead of what the method was supposed to produce.
- Do whatever you can in the current context and rethrow the same exception to a higher context.
- Do whatever you can in the current context and throw a different exception to a higher context.
- Terminate the program.
- Simplify. (If your exception scheme makes things more complicated, then it is painful and annoying to use.)
- Make your library and program safer. (This is a short-term investment for debugging, and a long-term investment for application robustness.)
posted on 2006-12-07 14:59
人生如戏 阅读(245)
评论(0) 编辑 收藏