hartwork / mozilla-password-decrypt

:unlock: Decrypt passwords stored by Firefox, Thunderbird, Iceweasel, Icedove using libnss3.so
7 stars 4 forks source link

Renamed exceptions #6

Closed nyov closed 9 years ago

nyov commented 9 years ago

Shortened the exception names, as "Failure" is usually synonymous with "Exception", or not really necessary in the name and can be provided by the exception's message IMHO.

BaseException "is not meant to be directly inherited by user-defined classes" (https://docs.python.org/2/library/exceptions.html#exceptions.BaseException), changed that.

Then I supposed if there is a 'decrypt.py' there might be an 'encrypt.py' later to share these, so I made them module-wide imports. Maybe they should just go into the __init__.py instead, not sure, I guess that depends on file layout TBD as part of #5.

This is a commit on top of PR #4.

nyov commented 9 years ago

now renamed FailedException to Error as per the comment

hartwork commented 9 years ago

Thanks for pointing me to not inherit from BaseException. Interestingly, it would still be

try BaseException as e:

rather than

try Exception as e:

to really catch all exceptions (when access to the instance is needed).

A copyright header is missing and only some exceptions have doc strings (which looks rather inconsistent) but it's good enough and I can fix that myself after.