-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add custom error handling for API errors #205
base: master
Are you sure you want to change the base?
Add custom error handling for API errors #205
Conversation
Adds minimal structure within a new client folder
Adds: - A Node dataclass which models an individual node (with dcid, name, etc) - A NodeGroup dataclass which represents a list of Node objects - An Arcs dataclass, which represents arcs (with a label and containing NodeGroups) - A Properties dataclass which represents a list of Properties
Adds: - An Observation dataclass which models an individual observation (date, value) - An OrderedFacets dataclass which models the 'ordered facets' of observations - A Variable dataclass which represents a variable data (grouped by entity) - A Facet class which represents the metadata for a facet
Adds: - A candidate dataclass to model candidates in the response (with dcid and dominanType) - An Entity dataclass to model entities with their resolution candidates
Adds: - A Cell dataclass to model a single cell in a row - A Row modelling a row with cells.
Adds tests for node, observation, resolve and sparql models.
DCResponse just wraps around the api response
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
@@ -0,0 +1,78 @@ | |||
from typing import Optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: typo in the filename
Note:
First PR in the stack: #202
Second PR in the stack: #203
Previous PR in the stack: #204
Next PR in the stack: #206
Will manually rebase as PRs in the stack are merged to make it easier to review the changes introduced in this PR.
This PR implements custom error handling for API errors. It also includes the related tests.
A bit unrelated but for housekeeping, the imports throughout the module are now passed through
isort
with Google profile for consistent ordering.Error Handling:
datacommons_client/utils/error_hanlding.py
: Introduced new error handling classes (DataCommonsError
,APIError
,DCConnectionError
,DCStatusError
,DCAuthenticationError
,InvalidDCInstanceError
).datacommons_client/tests/utils/test_error_handling.py
: Added tests for the different error classes.