Adjust exceptions handling
PEP8 tidy