def _raise_for_all_others(error, match, engine_name, is_disconnect): LOG.exception(_LE('DB exception wrapped.')) raise exception.DBError(error)
def update(self): raise db_exception.DBError( inner_exception=exc.IntegrityError('a', 'a', 'a'))
def _raise_savepoints_as_dberrors(error, match, engine_name, is_disconnect): # NOTE(rpodolyaka): this is a special case of an OperationalError that used # to be an InternalError. It's expected to be wrapped into oslo.db error. raise exception.DBError(error)
def __init__(self): self._cell_data_sync = mock.Mock() self._cell_data_sync.side_effect = [db_exc.DBError(), []] super(TestCellStateManagerDB, self).__init__()
def test_add_datasource_db_error(self, add_ds): add_ds.side_effect = db_exc.DBError('Error in db.') req = self._get_datasource_request() self.assertRaises(congressException.DatasourceCreationError, self.ds_manager.add_datasource, req)
def _raise_for_all_others(error, match, engine_name, is_disconnect): LOG.warn('DB exception wrapped.', exc_info=True) raise exception.DBError(error)
def fake_db_disassociate_all(context, id): if id == 'Trouble': raise db_exc.DBError() pass
def fake_db_update(context, specs_id, values): raise db_exc.DBError()
def fake_db_disassociate(context, id, type_id): if id == 'Trouble': raise db_exc.DBError() elif type_id == 'NotFound': raise exception.VolumeTypeNotFound(volume_type_id=type_id) pass
def fake_db_disassociate(context, id, type_id): raise db_exc.DBError()
def test_create_port_catch_db_error(self): self._test__port_action_with_failures(exc=db_exc.DBError(), action='create_port')
def test_translates_DBerror_inner_exception(self): with testtools.ExpectedException(db_exc.RetryRequest): with db_api.exc_to_retry(ValueError): raise db_exc.DBError(ValueError())
def test_mysql_savepoint_error(self): e = db_exc.DBError("(pymysql.err.InternalError) (1305, u'SAVEPOINT " "sa_savepoint_1 does not exist')") self.assertIsNone(self._decorated_function(1, e))