[Pulp-list] Swallowing Exceptions Reminder

Jay Dobies jason.dobies at redhat.com
Wed Apr 6 15:55:20 UTC 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In our client codebase:

        try:
            f = open(self.path)
            uuid = f.read()
            f.close()
            if delete:
                self.delete()
            return uuid
        except:
            pass


There are very few times (if ever) that we'd ever want to just have
"pass" in an exception block. Even if we don't display it to the user
and just log it, it's still better to be able to look around and find
out something went wrong than not having any information at all.


- -- 
Jay Dobies
RHCE# 805008743336126
Freenode: jdob
http://pulpproject.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNnIzoAAoJEOMmcTqOSQHCg44H/RAFDK/G5aPy120dayodUK6H
LJBGQp+33/WaWOPHY/qp8WMjngjSqgCJdFR3b2RW1+nsrrsWOzGnwdb4JVuIvMZ2
bbs3lFxeDvN9YK5mAiYPhy3g9PYa+oyh8B3kbIbOJmB6MT5MSGe7jLNw/DgHNj7a
LcOBNS7RT97prlLtr0tLQSRzyoFWFTIvOMItH+axelUseSMfU6zx98EAz2ZIycTe
9X5Y4e4OWpYYbhePNs5Fah4F02LKj/MJvgHBelrYpyOWYn28RnrmJssk0we07lEu
7uMNYNt2JCZgRzAyPF9u9UuAnSnc6VFxvkaEV4d1tZMgInyKZt3UepBbNkhaYxg=
=BrFf
-----END PGP SIGNATURE-----




More information about the Pulp-list mailing list