Closed singhpratyush closed 8 years ago
We are using too broad exception clauses (except Exception as e:) at many places. This is not a good exercise. We must identify the possible exceptions that may occur and take steps accordingly.
except Exception as e:
Some examples are -
try: makedirs(location) except Exception: print_warning('Download directory already exists')
try: raw_html = str(request.urlopen(req).read(), 'utf-8') done = True except Exception: print_error('{0} : Error occurred while getting {1}, retrying'.format(thread_id, website))
No longer an issue.
We are using too broad exception clauses (
except Exception as e:
) at many places. This is not a good exercise. We must identify the possible exceptions that may occur and take steps accordingly.Some examples are -