cleanup: replace more naked excepts with more specific ones
authorBrodie Rao <brodie@sf.io>
Sun, 13 May 2012 13:17:31 +0200
changeset 16703 7292a4618f46
parent 16702 1751d96d324f
child 16704 1f3acc30bdfe
cleanup: replace more naked excepts with more specific ones
mercurial/ui.py
mercurial/util.py
tests/tinyproxy.py
--- a/mercurial/ui.py	Sun May 13 13:17:27 2012 +0200
+++ b/mercurial/ui.py	Sun May 13 13:17:31 2012 +0200
@@ -488,9 +488,9 @@
 
     def flush(self):
         try: self.fout.flush()
-        except: pass
+        except (IOError, ValueError): pass
         try: self.ferr.flush()
-        except: pass
+        except (IOError, ValueError): pass
 
     def interactive(self):
         '''is interactive input allowed?
--- a/mercurial/util.py	Sun May 13 13:17:27 2012 +0200
+++ b/mercurial/util.py	Sun May 13 13:17:31 2012 +0200
@@ -762,7 +762,7 @@
         ofp.close()
     except:
         try: os.unlink(temp)
-        except: pass
+        except OSError: pass
         raise
     return temp
 
--- a/tests/tinyproxy.py	Sun May 13 13:17:27 2012 +0200
+++ b/tests/tinyproxy.py	Sun May 13 13:17:31 2012 +0200
@@ -47,7 +47,7 @@
         try: soc.connect(host_port)
         except socket.error, arg:
             try: msg = arg[1]
-            except: msg = arg
+            except (IndexError, TypeError): msg = arg
             self.send_error(404, msg)
             return 0
         return 1