Jaymon / prom

A PostgreSQL or SQLite orm for Python
MIT License
22 stars 4 forks source link

more differentiated exceptions #8

Closed Jaymon closed 1 year ago

Jaymon commented 9 years ago

Right now everything just gets raised as an InterfaceError, but this should be broken down even more, so there should be IntegrityError and ConnectionError etc. all children of InterfaceError, this way we can normalize the errors between all interfaces and yet be able to pick and choose what we want to catch because right now if you just want to ignore an integrity error you have to catch all the errors which is pretty bad, because the code might silently ignore a more serious error

Jaymon commented 9 years ago

This is a little more difficult than I thought it would be at first. It looks like right now the best solution will be to modify Interface.raise_error() to take in an exception class, so when Interface.connection() calls .raise_error() it could pass in an exception class that raise_error should use when it wraps the error.