def set_failure(self, **metadata): self._status = 2 # FIXME: This currently clumsily breaks through abstraction # layers. This should create a Failure instead of a # Neo4jError. See also HTTPResponse.audit from py2neo.database.work import Neo4jError self._failure = Neo4jError.hydrate(metadata)
def audit(self, tx=None): if self.errors(): # FIXME: This currently clumsily breaks through abstraction # layers. This should create a Failure instead of a # Neo4jError. See also BoltResponse.set_failure from py2neo.database.work import Neo4jError failure = Neo4jError.hydrate(self.errors().pop(0)) if tx is not None: tx.mark_broken() raise failure