Why is try {…} finally {…} good; try {…} catch{} bad?

http://stackoverflow.com/questions/128818/why-is-try-finally-good-try-catch-bad

The big difference is that try...catch will swallow the exception, hiding the fact that an error occurred. 

try..finally will run your cleanup code and then the exception will keep going, to be handled by something that knows what to do with it.

 

posted @ 2016-04-13 14:24  ChuckLu  阅读(177)  评论(0编辑  收藏  举报