Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit eaa3f8a

Browse files
author
Samuel Hassine
committed
[client] Try/expect expectations
1 parent 0274a86 commit eaa3f8a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pycti/api/opencti_api_work.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ def report_expectation(self, work_id: str, error):
4444
}
4545
}
4646
"""
47-
self.api.query(query, {"id": work_id, "error": error})
47+
try:
48+
self.api.query(query, {"id": work_id, "error": error})
49+
except:
50+
self.api.log("error", "Cannot report expectation")
4851

4952
def add_expectations(self, work_id: str, expectations: int):
5053
logging.info(
@@ -59,7 +62,10 @@ def add_expectations(self, work_id: str, expectations: int):
5962
}
6063
}
6164
"""
62-
self.api.query(query, {"id": work_id, "expectations": expectations})
65+
try:
66+
self.api.query(query, {"id": work_id, "expectations": expectations})
67+
except:
68+
self.api.log("error", "Cannot report expectation")
6369

6470
def initiate_work(self, connector_id: str, friendly_name: str) -> str:
6571
logging.info("Initiate work for " + connector_id)

0 commit comments

Comments
 (0)