Skip to content

Commit

Permalink
fix: don't log "unknown" event if polling failed (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveitaly committed Feb 8, 2022
1 parent fd219b8 commit 34307c2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions aw_watcher_window/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
import traceback
import sys
import os
from time import sleep
Expand Down Expand Up @@ -67,15 +66,13 @@ def heartbeat_loop(client, bucket_id, poll_time, strategy, exclude_title=False):
logger.info("window-watcher stopped because parent process died")
break

current_window = None

try:
current_window = get_current_window(strategy)
logger.debug(current_window)
except Exception as e:
logger.error(
"Exception thrown while trying to get active window: {}".format(e)
)
traceback.print_exc()
current_window = {"app": "unknown", "title": "unknown"}
logger.exception("Exception thrown while trying to get active window")

now = datetime.now(timezone.utc)
if current_window is None:
Expand Down

0 comments on commit 34307c2

Please sign in to comment.