关于使用Exceptions的几点小贴士

1. Exception handling is not supposed to replace a simple test. The moral is: Use exceptions for exceptional circumstances only.

2. Do not micromanage exceptions.

3. Make good use of the exception hierarchy.

4. Do not squelch exceptions.

5. When you detect an error, “tough love” works better than indulgence.

6. Propagating exceptions is not a sign of shame.

  Rules 5 and 6 can be summarized as “throw early, catch late.”

你可能感兴趣的:(关于使用Exceptions的几点小贴士)