Merge "Store and log correct exception info"
This commit is contained in:
commit
29effc67fc
|
@ -64,8 +64,11 @@ class Transaction(api.Transaction):
|
|||
def commit(self):
|
||||
ovsdb_connection.queue_txn(self)
|
||||
result = self.results.get()
|
||||
if isinstance(result, Exception) and self.check_error:
|
||||
raise result
|
||||
if self.check_error:
|
||||
if isinstance(result, idlutils.ExceptionResult):
|
||||
if self.log_errors:
|
||||
LOG.error(result.tb)
|
||||
raise result.ex
|
||||
return result
|
||||
|
||||
def do_commit(self):
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
import os
|
||||
import Queue
|
||||
import threading
|
||||
import traceback
|
||||
|
||||
from ovs.db import idl
|
||||
from ovs import poller
|
||||
|
@ -80,7 +81,9 @@ class Connection(object):
|
|||
try:
|
||||
txn.results.put(txn.do_commit())
|
||||
except Exception as ex:
|
||||
txn.results.put(ex)
|
||||
er = idlutils.ExceptionResult(ex=ex,
|
||||
tb=traceback.format_exc())
|
||||
txn.results.put(er)
|
||||
self.txns.task_done()
|
||||
|
||||
def queue_txn(self, txn):
|
||||
|
|
|
@ -21,6 +21,12 @@ from ovs import poller
|
|||
from ovs import stream
|
||||
|
||||
|
||||
class ExceptionResult(object):
|
||||
def __init__(self, ex, tb):
|
||||
self.ex = ex
|
||||
self.tb = tb
|
||||
|
||||
|
||||
def get_schema_helper(connection):
|
||||
err, strm = stream.Stream.open_block(
|
||||
stream.Stream.open(connection))
|
||||
|
|
Loading…
Reference in New Issue