Skip to content

Commit c402719

Browse files
committed
Remove catch-all except clauses
1 parent 7bd455d commit c402719

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

plugins/reddit_info.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ def moremod(text, chan):
5454
if text:
5555
try:
5656
index = int(text)
57-
except:
57+
except ValueError:
5858
return "Please specify an integer value."
59-
if abs(int(index)) > len(search_pages[chan]) or index == 0:
59+
if abs(index) > len(search_pages[chan]) or index == 0:
6060
return "please specify a valid page number between 1 and {}.".format(len(search_pages[chan]))
6161
else:
6262
return "{}(page {}/{})".format(search_pages[chan][index-1], index, len(search_pages[chan]))
@@ -80,14 +80,14 @@ def moderates(text, chan):
8080
if r.status_code != 200:
8181
return statuscheck(r.status_code, user)
8282
soup = BeautifulSoup(r.text)
83-
try:
84-
modlist = soup.find('ul', id="side-mod-list").text
85-
except:
83+
mod_list = soup.find('ul', id="side-mod-list")
84+
if mod_list is None:
8685
return "{} does not moderate any public subreddits.".format(user)
87-
modlist = modlist.split('r/')
88-
del modlist[0]
86+
87+
mod_list = mod_list.text.split('r/')
88+
del mod_list[0]
8989
out = "\x02{}\x02 moderates these public subreddits: ".format(user)
90-
for sub in modlist:
90+
for sub in mod_list:
9191
out += "{} \u2022 ".format(sub)
9292
out = out[:-2]
9393
out = smart_truncate(out)

0 commit comments

Comments
 (0)