@@ -253,10 +253,12 @@ def decl_update_access(self, user_ids: list[str], source_id: str, session_: orm.
253253 session .commit ()
254254 except SafeDbException as e :
255255 session .rollback ()
256- raise e
256+ logger .info ('Error: declaratively updating access list' , exc_info = e , extra = {
257+ 'source_id' : source_id ,
258+ })
257259 except Exception as e :
258260 session .rollback ()
259- raise DbException ('Error: updating access list' ) from e
261+ raise DbException ('Error: declaratively updating access list' ) from e
260262 finally :
261263 if session_ is None :
262264 session .close ()
@@ -278,9 +280,12 @@ def update_access(
278280 )
279281 result = session .execute (stmt ).fetchone ()
280282 if result is None :
281- if session_ is None :
282- session .close ()
283- raise SafeDbException ('Error: source id not found' , 404 )
283+ raise SafeDbException (
284+ 'Error: source id not found. It is possible that this document is still in the index queue'
285+ ' and has not been added to the database yet.'
286+ ' This is generally not an error and will resolve itself when the document is indexed.' ,
287+ 404 ,
288+ )
284289
285290 match op :
286291 case UpdateAccessOp .allow :
@@ -310,12 +315,12 @@ def update_access(
310315 # check if all entries related to the source were deleted
311316 self ._cleanup_if_orphaned ([source_id ], session )
312317 case _:
313- if session_ is None :
314- session .close ()
315318 raise SafeDbException ('Error: invalid access operation' , 400 )
316319 except SafeDbException as e :
317320 session .rollback ()
318- raise e
321+ logger .info ('Error: updating access list' , exc_info = e , extra = {
322+ 'source_id' : source_id ,
323+ })
319324 except Exception as e :
320325 session .rollback ()
321326 raise DbException ('Error: updating access list' ) from e
0 commit comments