Add more specific exception capture