Permalink
Browse files

No more bare except blocks.

  • Loading branch information...
1 parent 10c0a62 commit d7ee7bb0fc9298c03ad3a4675c84896721c89bb2 @mattbasta committed Sep 20, 2012
@@ -8,7 +8,7 @@ def detect_opensearch(err, package, listed=False):
# Parse the file.
try:
srch_prov = parse(package)
- except:
+ except Exception:
err.error(
err_id=("opensearch",
"detect_opensearch",
@@ -251,7 +251,7 @@ def _process_file(err, xpi_package, name, file_data, name_lower,
try:
sub_xpi = XPIManager(package, mode="r", name=name,
subpackage=is_subpackage)
- except:
+ except Exception:
err.error(("testcases_content",
"test_packed_packages",
"jar_subpackage_corrupt"),
@@ -310,7 +310,7 @@ def wrap(wrapper, arguments, traverser):
", ".join(map(str, params)))
try:
output = func(*params)
- except:
+ except (ValueError, TypeError):
# If we cannot compute output, just return nothing.
output = None
@@ -119,7 +119,7 @@ def _get_tree(code, shell):
try:
temp.close()
os.unlink(temp.name)
- except:
+ except IOError:
pass
if not data:
@@ -48,7 +48,7 @@ def _parse(self, data):
line += "\n"
try:
parser.feed(line)
- except:
+ except Exception:
parser = DTDXMLParser()
else:
if parser.out_buffer:
@@ -25,7 +25,7 @@ def test_css_file(err, filename, data, line_start=1):
filename=filename,
line_start=line_start - 1,
context=context)
- except: # pragma: no cover
+ except Exception: # pragma: no cover
# This happens because tokenize is a generator.
# Bravo, Mr. Bond, Bravo.
err.warning(("testcases_markup_csstester",
@@ -122,7 +122,7 @@ def _feed_parser(self, line):
try:
line = line.decode("ascii", "ignore")
self.feed(line + "\n")
- except:
+ except Exception:
raise exc_instance, None, traceback
except Exception as inst:
@@ -31,7 +31,7 @@ def decode(data):
# Try straight UTF-8
try:
return unicode(data, "utf-8")
- except:
+ except UnicodeDecodeError:
pass
# Test for latin_1, because it can be matched as UTF-16
@@ -40,7 +40,7 @@ def decode(data):
if all(ord(c) < 256 for c in data):
try:
return unicode(data, "latin_1")
- except:
+ except UnicodeDecodeError:
pass
# Test for various common encodings.

0 comments on commit d7ee7bb

Please sign in to comment.