MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / __exit__

Method __exit__

sdk-python/src/graphlite_sdk/transaction.py:180–202  ·  view source on GitHub ↗

Context manager exit - automatically rollback if not committed If an exception occurred, always rollback. If no exception, rollback unless commit() was called.

(self, exc_type, exc_val, exc_tb)

Source from the content-addressed store, hash-verified

178 return self
179
180 def __exit__(self, exc_type, exc_val, exc_tb):
181 """
182 Context manager exit - automatically rollback if not committed
183
184 If an exception occurred, always rollback.
185 If no exception, rollback unless commit() was called.
186 """
187 if exc_type is not None:
188 # Exception occurred, always rollback
189 if not self._committed and not self._rolled_back:
190 try:
191 self.rollback()
192 except Exception:
193 pass # Ignore rollback errors during exception handling
194 else:
195 # No exception - rollback if not committed
196 if not self._committed and not self._rolled_back:
197 try:
198 self.rollback()
199 except Exception:
200 pass # Ignore rollback errors
201
202 return False # Don't suppress exceptions
203
204
205__all__ = ['Transaction']

Callers

nothing calls this directly

Calls 1

rollbackMethod · 0.95

Tested by

no test coverage detected