Skip to content

Commit

Permalink
remove broad exception from classes
Browse files Browse the repository at this point in the history
  • Loading branch information
𝐢𝐁𝐮𝐠 ♦ committed Oct 7, 2018
1 parent b69ecb0 commit 3a0ffc3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions apigetpost.py
Expand Up @@ -38,12 +38,8 @@ def as_dict(self):
'up_vote_count': self.up_vote_count,
'down_vote_count': self.down_vote_count,
'edited': (self.creation_date != self.last_edit_date),
'IsAnswer': getattr(self, 'IsAnswer', False),
}
# noinspection PyBroadException
try:
dictdata['IsAnswer'] = getattr(self, 'IsAnswer')
except AttributeError:
dictdata['IsAnswer'] = False # Assume it's not an answer

return dictdata

Expand Down
4 changes: 2 additions & 2 deletions classes/_Post.py
Expand Up @@ -183,7 +183,7 @@ def answers(self):
# noinspection PyBroadException
try:
return self._answers
except:
except AttributeError:
return None

@property
Expand Down Expand Up @@ -226,7 +226,7 @@ def post_site(self):
def post_url(self):
try:
return str(self._post_url)
except:
except (AttributeError, ValueError):
return "NoLink"

@property
Expand Down
2 changes: 1 addition & 1 deletion tox_classes.ini
@@ -1,3 +1,3 @@
[flake8]
ignore = E501,F403,E402,F405,N804,F401,N801,E722
ignore = E501,F403,E402,F405,N804,F401,N801
exclude = ChatExchange/*,.idea/*,.git/*

0 comments on commit 3a0ffc3

Please sign in to comment.