Skip to content

Commit 8b3c6fc

Browse files
authored
Merge pull request #178 from aanil/aggreg_qc
Cloudant raises exception if document is not found
2 parents 7212071 + 74177bb commit 8b3c6fc

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

scripts/escalation_running_notes.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import markdown
1515
import yaml
1616
from genologics_sql.utils import get_session
17+
from ibm_cloud_sdk_core.api_exception import ApiException
1718
from sqlalchemy import text
1819
from sqlalchemy.orm import aliased
1920

@@ -74,7 +75,10 @@ def make_esc_running_note(
7475

7576
def update_note_db(note):
7677
updated = False
77-
note_existing = couch.get_document(db=db, doc_id=note["_id"]).get_result()
78+
try:
79+
note_existing = couch.get_document(db=db, doc_id=note["_id"]).get_result()
80+
except ApiException:
81+
note_existing = None
7882
if "_rev" in note.keys():
7983
del note["_rev"]
8084

0 commit comments

Comments
 (0)