- marked as major
Many parts of the code raise None exception rather than original exception, that can not find the real error。
Issue #2357
resolved
Many parts of the code raise None exception rather than original exception, that can not find the real error。
For example: SQLAlchemy-0.7.1/sqlalchemy/orm/session.py, in line 1561, in _flush
Because i use eventlet.db_pool without charset option, I got TypeError: exceptions must be old-style classes or derived from BaseException, not NoneType, but actually encoding errors。
Comments (3)
-
repo owner -
repo owner SQLA 0.7.1, line 1561:
except: transaction.rollback(_capture_exception=True) raise
This is a standard Python re-raise (documented at http://docs.python.org/tutorial/errors.html#handling-exceptions). The exception information retrieved from the
except:
is maintained. -
repo owner - changed status to wontfix
OK it seems this is an issue on the eventlet side, doing a worksforme here.
- Log in to comment
Need detailed information about the specific issue, description is too vague (note the guidelines for posting bugs at http://www.sqlalchemy.org/participate.html#bugs request that a full, succinct, reproducing test case for the bug is attached).
Line 1561 of _session.py does not handle user input or by itself raise any exception:
SQLAlchemy exceptions derive from SQLAlchemyError, which in turn derives from Python's base Exception class (line 17, exc.py):
They don't extend from
NoneType
, which is not even possible in Python.Per Python's own documentation, inheriting from
Exception
is the correct approach. See#2160. Citing http://docs.python.org/library/exceptions.html:And directly below that:
I'm not familiar with eventlet.db_pool, though SQLAlchemy does not currently have supported integration paths with asynchronous systems. Certainly if it requires that exceptions are implemented as old style classes and not extending
Exception
, that's a bug in eventlet, not SQLAlchemy.