File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,9 +112,11 @@ def get(self, id: int):
112112 with self ._ob .read_tx ():
113113 c_data = ctypes .c_void_p ()
114114 c_size = ctypes .c_size_t ()
115- obx_box_get (self ._c_box , id , ctypes .byref (
116- c_data ), ctypes .byref (c_size ))
117-
115+ try :
116+ obx_box_get (self ._c_box , id , ctypes .byref (
117+ c_data ), ctypes .byref (c_size ))
118+ except NotFoundException :
119+ return None
118120 data = c_voidp_as_bytes (c_data , c_size .value )
119121 return self ._entity .unmarshal (data )
120122
@@ -143,7 +145,11 @@ def remove(self, id_or_object):
143145 id = self ._entity .get_object_id (id_or_object )
144146 else :
145147 id = id_or_object
146- obx_box_remove (self ._c_box , id )
148+ try :
149+ obx_box_remove (self ._c_box , id )
150+ return True
151+ except NotFoundException :
152+ return False
147153
148154 def remove_all (self ) -> int :
149155 count = ctypes .c_uint64 ()
You can’t perform that action at this time.
0 commit comments