Why are doing this?

In general this is weak code, it introduces a runtime type dependency on the exception. we should do this on all exception or none of them, we shouldn't introduce conditional type tests like this