Preserve exception tracebacks, add more entity type annotations

Instead of just getting a backtrace that ends at `ProgrammingError(Invalid database username or password)` we will now get the full traceback.

Also add some more epydoc type annotations to the entity code.