TheTorProject / gettor

GetTor - a Tor Browser distribution system
https://gitweb.torproject.org/gettor.git
Other
106 stars 40 forks source link

Exception class handling #8

Closed mmcco closed 7 years ago

mmcco commented 9 years ago

This is a minor point, but I thought it worth mentioning. It's usually best to make exceptions' strings explain their context. Namely, at the end of core_demo.py, you have a bunch of exception-catching conditions, but if their strings contained the context ('Misconfiguration: '), for example, you could use a single catch-all.

Awesome job, by the way! I was browsing the code after reading your blog post.

mmcco commented 9 years ago

More generally, it's only worth defining new Exception classes when you expect them to be handled uniquely. I don't know enough about your code to comment on that, though.

ilv commented 9 years ago

Hi, thanks for the comments!

I tried to define Exceptions for different behaviours, but some of them have different names just for clarity. I don't have much experience with Python, so I'm sure there are various things that might not be standard. Anyway, thanks for pointing this out.