secynic / ipwhois

Retrieve and parse whois data for IPv4 and IPv6 addresses
https://ipwhois.readthedocs.io/en/latest
BSD 2-Clause "Simplified" License
555 stars 121 forks source link

Make exception inherit from a base one #205

Closed Darkheir closed 6 years ago

Darkheir commented 7 years ago

I think it would be interesting to make all the exception inherit from a base one, IPWhoisError for example. It would makes it easier to catch all the exception of the module without having to catch everything.

If you are up for it I can submit a pull request.

secynic commented 7 years ago

That is a good idea. I would rather call it BaseIpwhoisException. Note the case; I don't want to associate it with the IPWhois class, as a lot of those exceptions are for other classes.

Keep in mind that not everything in the library is going to raise a custom exception. Without looking, I know it is raising some of the built-ins like ValueError, KeyError, etc. This solution won't account for those.

Darkheir commented 7 years ago

Yes it's true but this is a good, It will catch exception that are related with the domain of the lib (wrong ip, ...)

secynic commented 6 years ago

Merged