This change seems to be unrelated to the rest. Please split it into another request.
Also note that this change changes bahaviour on the expected exception type on places where it's used. Make sure it doesn-t affect those places.