Fix dbapi error to comply with pep
- fixes #319
Checklist:
- [x] Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
- [x] Add or update relevant docs, in the docs folder and in code.
- [x] Ensure PR doesn't contain untouched code reformatting: spaces, etc.
- [x] Run
flake8and fix issues. - [x] Run
pytestno tests failed. See https://clickhouse-sqlalchemy.readthedocs.io/en/latest/development.html.
It changes the native and http and asynch. I am a little confused about the native and http. The native wraps the error in DatabaseException. Does it ensure that all errors are caught as DatabaseException? Can we delete DatabaseException? For http, what is the basic error? Exception may be too wide.
Updated. Will only change asynch dbapi error. By the way,
class Error(Exception):
pass
This does not mean "catch all exceptions". This creates a new exception called "Error", but no one will ever try to raise it.
If you agree to this change, I will write a unittest ASAP.
It's better to write
from asynch.errors import ClickHouseException
...
Error = ClickHouseException
Yes, please write a test for this fix.
coverage: 86.276% (-0.005%) from 86.281% when pulling 0a055c758e73810b6fda6967d726f65ca2b89dba on Simon-Chenzw:master into 523559e625e59b7f39bfaaff4fb58a52a1e33a34 on xzkostyan:master.
Test added, sorry for the wait. I think it's a breaking change so we need to update the changelog?