Skip to content

Commit 7698b77

Browse files
committed
flake8 - bare exceptions
Converted two nested fallback capture any exception handlers from "except:" into "except Exception" and one into 'except ValueError' to handle a non-int passed to int().
1 parent a2718d3 commit 7698b77

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

roundup/cgi/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2076,7 +2076,7 @@ def renderContext(self):
20762076
return '<strong>%s</strong>' % html_escape(str(message))
20772077
except templating.Unauthorised as message:
20782078
raise Unauthorised(html_escape(str(message)))
2079-
except:
2079+
except Exception:
20802080
# everything else
20812081
if self.instance.config.WEB_DEBUG:
20822082
return cgitb.pt_html(i18n=self.translator)
@@ -2088,7 +2088,7 @@ def renderContext(self):
20882088
self.send_error_to_admin(subject, cgitb.pt_html(), format_exc())
20892089
# Now report the error to the user.
20902090
return self._(default_err_msg)
2091-
except:
2091+
except Exception:
20922092
# Reraise the original exception. The user will
20932093
# receive an error message, and the adminstrator will
20942094
# receive a traceback, albeit with less information
@@ -2523,7 +2523,7 @@ def handle_range_header(self, length, etag):
25232523
last = int(last)
25242524
else:
25252525
last = length - 1
2526-
except:
2526+
except ValueError:
25272527
# The positions could not be parsed as integers.
25282528
return None
25292529
# Check that the range makes sense.

0 commit comments

Comments
 (0)