250 group.thumbnail_image_url = uploaded_images['thumbnail_image_url']
251 save_to_db(group)
252 logging.info(f'Resized images saved successfully for group with id: {group_id}')
253 except (requests.exceptions.HTTPError, requests.exceptions.InvalidURL, OSError):254 logging.exception(
255 'Error encountered while generating resized images for group with id: {}'.format(
256 group_id
250 group.thumbnail_image_url = uploaded_images['thumbnail_image_url']
251 save_to_db(group)
252 logging.info(f'Resized images saved successfully for group with id: {group_id}')
253 except (requests.exceptions.HTTPError, requests.exceptions.InvalidURL, OSError):254 logging.exception(
255 'Error encountered while generating resized images for group with id: {}'.format(
256 group_id
228 logging.info(
229 f'Resized images saved successfully for exhibitor with id: {exhibitor_id}'
230 )
231 except (requests.exceptions.HTTPError, requests.exceptions.InvalidURL, OSError):232 logging.exception(
233 'Error encountered while generating resized images for exhibitor with id: {}'.format(
234 exhibitor_id
228 logging.info(
229 f'Resized images saved successfully for exhibitor with id: {exhibitor_id}'
230 )
231 except (requests.exceptions.HTTPError, requests.exceptions.InvalidURL, OSError):232 logging.exception(
233 'Error encountered while generating resized images for exhibitor with id: {}'.format(
234 exhibitor_id
108 uploaded_image = create_system_image(
109 data['system_image_url'], unique_identifier=event_topic.id
110 )
111 except (urllib.error.HTTPError, urllib.error.URLError):112 raise UnprocessableEntityError(
113 {'source': 'attributes/system-image-url'}, 'Invalid Image URL'
114 )
Two or more exceptions in the same exception handler clause that are identical or parts of the same inheritance hierarchy (i.e. overlapping). It is recommmend to refactor this.
class SomeException(Exception):
pass
class SubclassException(SomeException):
pass
try:
raise SubclassException()
except (SomeException, SubclassException):
pass
Here, SubclassException
has been derived from SomeException
, which makes it overlapping.
class SomeException(Exception):
pass
class SubclassException(SomeException):
pass
try:
raise SubclassException()
except SomeException:
pass