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

Error handling for remote Geo service #94

Merged
merged 2 commits into from
Oct 13, 2021

Conversation

pke11y
Copy link
Contributor

@pke11y pke11y commented Oct 12, 2021

This PR adds error handling for the remote Geo service that provides the timezone based on city name. This function is in the utils module and is currently used by the Cogent parser.

Fixes #43

) # TODO: Offline loading of timezone location data is quite slow. Look for better alternative
return timezone.tzNameAt(location.latitude, location.longitude)
except (GeocoderUnavailable, GeocoderTimedOut, GeocoderServiceError):
raise RemoteGeoAPIError( # pylint: disable=raise-missing-from
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we handling this exception raise? I mean, we are changing the expection object, but it's still a exception :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah of course, good point. ParserError would be a better option.

Copy link
Collaborator

@chadell chadell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chadell chadell merged commit 2458590 into networktocode:develop Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky Cogent parser due dependency on external API Geo
2 participants