improvement in exception parsing logic