Catch Exception treatment

前端 未结 5 1981
情歌与酒
情歌与酒 2021-01-14 10:25

What\'s the difference between using

catch(Exception ex)
{
   ...
   throw ex;
}

and using

catch   //  might include  (Exc         


        
5条回答
  •  离开以前
    2021-01-14 11:08

    As far as I know, it's the same thing (using Exception.. because all the exceptions derive from that class). It becomes different when you catch only a child of Exception... or when you have several "catch" catching different children. It could also be that you catch Exception, modify the message, and throw it back out.

提交回复
热议问题