Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch all exceptions google analytics #327

Merged
merged 2 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -146,12 +145,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