fix #1246: catch exceptions caused by GA report failure

This commit is contained in:
debugtalk
2022-04-30 14:59:02 +08:00
parent 6af68be8be
commit 737379b49f
2 changed files with 9 additions and 2 deletions

View File

@@ -3,6 +3,7 @@
## 2.5.9 (2022-04-30)
- fix #1217: reload debugtalk.py if loaded
- fix #1246: catch exceptions caused by GA report failure
## 2.5.8 (2022-03-23)

View File

@@ -55,7 +55,10 @@ class GAClient(object):
'ev': value, # Optional. Event value, must be non-negative integer
}
data.update(self.common_params)
self.http_client.post(self.report_url, data=data)
try:
self.http_client.post(self.report_url, data=data, timeout=5)
except Exception: # ProxyError, SSLError, ConnectionError
pass
def track_user_timing(self, category, variable, duration):
data = {
@@ -66,7 +69,10 @@ class GAClient(object):
'utl': self.label, # Optional. user timing label, used as version.
}
data.update(self.common_params)
self.http_client.post(self.report_url, data=data)
try:
self.http_client.post(self.report_url, data=data, timeout=5)
except Exception: # ProxyError, SSLError, ConnectionError
pass
ga_client = GAClient("UA-114587036-1")