Error handling
This commit is contained in:
parent
3712ebb115
commit
717350e23c
@ -166,6 +166,7 @@ class EventsPullerThread(threading.Thread):
|
||||
else:
|
||||
logging.debug("A successful connection has been made!")
|
||||
|
||||
event: MediaEvent | None = None
|
||||
try:
|
||||
rows = self.getEventsAvailable(connection=self.connection)
|
||||
if (len(rows) == 0):
|
||||
@ -183,7 +184,7 @@ Found message
|
||||
============================================================================\n"""
|
||||
logger.info(logMessage)
|
||||
|
||||
event: MediaEvent = json_to_media_event(row["data"])
|
||||
event = json_to_media_event(row["data"])
|
||||
producedEvent = asyncio.run(MetadataEventHandler(event).run())
|
||||
|
||||
producedMessage = f"""
|
||||
@ -201,6 +202,7 @@ Producing message
|
||||
except Exception as e:
|
||||
"""Produce failure here"""
|
||||
logger.exception(e)
|
||||
try:
|
||||
producedEvent = MediaEvent(
|
||||
metadata = EventMetadata(
|
||||
referenceId=event.metadata.referenceId,
|
||||
@ -214,6 +216,8 @@ Producing message
|
||||
eventType="EventMediaMetadataSearchPerformed"
|
||||
)
|
||||
self.storeProducedEvent(connection=self.connection, event=producedEvent)
|
||||
except Exception as iex:
|
||||
logger.error("Failed to push error to database..")
|
||||
|
||||
except mysql.connector.Error as err:
|
||||
logger.error("Database error: %s", err)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user