Skip to content

Commit

Permalink
[Cherry pick] Catch all exceptions for google analytics (#328)
Browse files Browse the repository at this point in the history
* Catch all exceptions

* Update version to 1.5.1
  • Loading branch information
rahul-tuli committed Jun 2, 2023
1 parent e0992c6 commit 460d3f5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/sparsezoo/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import machineid
import requests
from requests import HTTPError

from sparsezoo.utils.gdpr import is_gdpr_country
from sparsezoo.utils.helpers import disable_request_logs
Expand Down Expand Up @@ -139,12 +138,12 @@ def _send_request():
body = response.content
if _DEBUG:
print(body)
except HTTPError as http_error:
except Exception as exception:
if _DEBUG:
print(http_error)
print(exception)

if raise_errors:
raise http_error
raise exception

thread = threading.Thread(target=_send_request)
thread.start()
Expand Down
3 changes: 1 addition & 2 deletions src/sparsezoo/utils/gdpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import geocoder
import requests
from requests import HTTPError

from sparsezoo.utils.helpers import disable_request_logs

Expand Down Expand Up @@ -79,7 +78,7 @@ def get_country_code() -> Optional[str]:
geo = geocoder.ip(ip)

return geo.country
except HTTPError:
except Exception:
return None


Expand Down
2 changes: 1 addition & 1 deletion src/sparsezoo/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from datetime import date


version_base = "1.5.0"
version_base = "1.5.1"
is_release = False # change to True to set the generated version as a release version


Expand Down

0 comments on commit 460d3f5

Please sign in to comment.