summaryrefslogtreecommitdiff
path: root/oslo_db/exception.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove legacy base test classesStephen Finucane2023-03-221-11/+0
| | | | | | | | The fixtures have been available for a very long time now. We can drop these. Change-Id: I1e71150ba6daeba464b6ed8d46163f1f34959db3 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
* Drop use of sixStephen Finucane2020-02-251-2/+1
| | | | | | | No need for this in a Python 3-only world. Change-Id: I8923f2b87c1bd114b8c55210100c7485a0de8f28 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
* Remove deprecated class DbMigrationError since we already have DBMigrationErrorYaguo Zhou2019-12-171-12/+1
| | | | Change-Id: Icb2c88dc18843cbf2f5be08d635d5ba10f36f360
* Move warnings to their own moduleStephen Finucane2018-10-171-24/+9
| | | | | | | | | | | | | | | | | | | | | | Raising warnings from an exception module can result in a rather confusing message: Running command: '/usr/bin/nova-scheduler ' /.../sqlalchemy/enginefacade.py:332: NotSupportedWarning: Configuration option(s) ['use_tpool'] not supported exception.NotSupportedWarning For someone not used to Python's 'warning' infrastructure, this can look worse than it is, as seen at [1]. While this particular warning was resolved in change I4a5f8958c3e, it's possible that a similar warning could be raised for other options. Best to move this out of the 'exception' module and into something more sensible. [1] https://bugzilla.redhat.com/show_bug.cgi?id=1639423 Change-Id: I8e0480fb11123067a111ed6aeda6b47614615645 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
* Remove property message for DBInvalidUnicodeParameter and InvalidSortKeysunguangning2017-09-111-19/+0
| | | | | Change-Id: Idace3cbe1ac3c454443d1c786054dc8ff0b0e8b5 Closes-Bug: #1714842
* Enable MySQL Storage Engine selectionoorgeron2017-06-261-0/+4
| | | | | | | | Enables new functionality for selecting InnoDB or MySQL Cluster as a DB storage backend in OpenStack services. Closes-Bug: 1564110 Change-Id: I9f1fd2a87fdf75332de2339d3ff4f08ce9220dcf
* Add a specific exception for 'unknown database' errorsRoman Podoliaka2016-10-101-0/+12
| | | | | | | | | | | | Add an exception filter to distinguish 'unknown database' errors from other DBAPIError's. This effectively means we no longer unconditionally print a traceback to logs, when someone tries to connect to a database, that does not exist, but just raise a specific exception instead and let the caller handle it. Closes-Bug: #1631033 Change-Id: Iebc1ec1e8153917fbcde116d04bc171272993bbd
* Memoize sys.exc_info() before attempting a savepoint rollbackMike Bayer2016-07-271-3/+4
| | | | | | | This presents a system of reporting the ultimate "cause" in the case that a MySQL failed SAVEPOINT rollback occurs. Change-Id: Iea834429a0b8398f076b10426525a5c17dbf3c85
* Merge "exception: make message mandatory in DbMigrationError and deprecates it"Jenkins2016-07-081-0/+14
|\
| * exception: make message mandatory in DbMigrationError and deprecates itJulien Danjou2016-06-271-0/+14
| | | | | | | | | | | | | | | | | | | | | | An exception message with None as an error message is not really useful. Since DbMigrationError is also wrongly written with a lower case b whereas everything else has a major B, let's create a new correct class and use it. debtcollector is used to deprecate the old one, and inheritance makes sure the current code works. Change-Id: Id9a477aff38afd5b664b75a549ad561f4c24b6f0
* | exc_filters: catch and translate non existent table on dropJulien Danjou2016-06-271-0/+12
| | | | | | | | | | | | | | This patches add a new exception type that is raised when an operation on a non existing table is executed. Change-Id: I931664987e359e7755b912ec25cb36f087ffcfa3
* | exc_filters: catch and translate non existent constraint on dropJulien Danjou2016-06-221-0/+15
|/ | | | | | | This patches add a new exception type that is raised when an operation on a non existing constraint is executed. Change-Id: Ib55a83b568bdb1c9139af27bd2fbf204508e15e4
* exceptions: provide .message attribute for Py3K compatibility4.4.0Roman Podoliaka2016-02-081-0/+15
| | | | | | | | | | | | | | | | | In two recent commits we fixed the way .message class attribute was used by passing it as an argument to __init__() of the base Exception class instead. Unfortunately, this currently breaks Heat unit tests on Py3K as exception instances no longer provide .message attribute there. Re-introduce .message properties only for exception classes that used to have them to ensure the new oslo.db release do not change the interface of exceptions. Closes-Bug: #1542961 Change-Id: I5cae408555956d77e6cbb4e5e513c1c6c375d29d
* InvalidSortKey constructor change breaks Heat unittestsDavanum Srinivas2016-02-061-1/+1
| | | | | | | | Just supply a default value None, to avoid breaking projects who currently use this exception. Closes-Bug: #1542671 Change-Id: Ia397cab309aa22a2a86964f2ff90a796c878b2e7
* exception: fix DBInvalidUnicodeParameter error messageJulien Danjou2016-02-041-2/+3
| | | | Change-Id: I1455f55929aa3a6037138770d407d247397c062b
* exceptions: enhance InvalidSortKey to carry the invalid keyJulien Danjou2016-02-021-2/+3
| | | | Change-Id: I6bb1b567cf962fd1c694d112a15e830367af2889
* exception: fix InvalidSortKey messageJulien Danjou2016-02-011-1/+3
| | | | Change-Id: I0e11ee6ffc56ee0399ad930fc9da49c7f16ca67b
* Improve failure mode handling in enginefacadeMike Bayer2015-07-271-2/+19
| | | | | | | | | | | | | | | | | | | | Check explicitly for the cases where no "sql_connection" attribute was set when running _start(), so that the lack of this parameter is documented by the exception rather than failing into create_engine() with an unclear failure mode. If _start() fails as it will here, make sure _started stays False so that repeated calls to _start() continue to raise the same exception, rather than raising attribute errors. When accessing the "session" or "connection" attributes of the context when these attributes were not requested by the decorator or context manager, raise explicit exceptions for each, rather than returning None which leads to hard-to-debug NoneType errors. Change-Id: Iadfbf4707daed4140285a3a472009f6863b18275 Closes-bug: 1477080
* Implement new oslo.db.sqlalchemy.enginefacade moduleMike Bayer2015-06-041-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | This module presents a replacement for the EngineFacade system. At the center is the oslo.db.sqlalchemy.enginefacade module, which when imported, provides decorators and context managers which perform all database and ORM connectivity functions transparently. The docstrings as well as the blueprint provide an introduction. The patch includes a refactoring of sqlalchemy/session.py into three dependent modules engines.py, orm.py and enginefacade.py. This is to maintain a non-cyclical import structure as well as to maintain the import behavior of oslo.db overall, as some projects such as glance currently have dependencies on this structure. There is also a slimming down and attempt at modernizing some very old documentation in session.py. The enginefacade system should be preferred moving forward. Implements: blueprint make-enginefacade-a-facade Change-Id: I9a3d0c26bb727eb2c0bd823b9a12fde57cc7c9c3
* Merge "Handle CHECK constraint integrity in PostgreSQL"Jenkins2015-04-101-0/+17
|\
| * Handle CHECK constraint integrity in PostgreSQLJulien Danjou2015-04-031-0/+17
| | | | | | | | | | | | | | | | PostgreSQL offers CHECK constraints integrity which are currently raised as generic error. This patch add a filter so they can have their own exception type. Change-Id: I7e36ef4385b227d1e62e18277d470047a369a238
* | Add filters for DBDataError exceptionRoman Podoliaka2015-04-091-0/+8
|/ | | | | | | | | | | | | | | We currently don't distinguish DB errors, that are due to problems with the processed data (like division by zero, numeric value out of range, incorrect data type passed, etc) This actually led to a problem when MySQL threw two different errors depending on the randomly generated UUID value and we wrapped only one of those cases properly, which caused the test case to fail time to time in the gate. Closes-Bug: #1442178 Change-Id: I02891f3b1ede6f33834e5637be43496499cc88e7
* Add retry decorator allowing to retry DB operations on requestEugene Nikanorov2015-01-301-0/+9
| | | | | | | | | Improve retrying decorator such that wrapped code could request retry attempt in the arbitrary conditions by raising RetryRequest exception. Wrapped code should provide inner exception that is raised when amount of retries are exceeded. Change-Id: I596fea8dc798a11fcdfdd69208af3313f41d755b
* Move files out of the namespace packageDoug Hellmann2014-12-241-0/+173
Move the public API out of oslo.db to oslo_db. Retain the ability to import from the old namespace package for backwards compatibility for this release cycle. Blueprint: drop-namespace-packages Change-Id: Ie96b482b9fbcb1d85203ad35bb65c1f43e912a44