changeset 16703:7292a4618f46

cleanup: replace more naked excepts with more specific ones
author Brodie Rao <brodie@sf.io>
date Sun, 13 May 2012 13:17:31 +0200
parents 1751d96d324f
children 1f3acc30bdfe
files mercurial/ui.py mercurial/util.py tests/tinyproxy.py
diffstat 3 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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