Skip to content

Commit

Permalink
Merge pull request #17 from CMUSTRUDEL/dev
Browse files Browse the repository at this point in the history
fix: raise on error in graphql queries
  • Loading branch information
user2589 authored Sep 26, 2020
2 parents 94bf17d + 0e73b74 commit faedab4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion stscraper/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def json_path(obj, path, raise_on_missing=False):
obj = ",".join(str(item.get(chunk[1:])) for item in obj)
# supported only for the last chunk in the path, so break
break
if chunk not in obj:
if obj is None or chunk not in obj:
if raise_on_missing:
raise IndexError('Path does not exist')
else:
Expand Down
6 changes: 3 additions & 3 deletions stscraper/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ class will help you with pagination and network timeouts.
{'login': 'neoascetic'}]
In the first case, it will return a dictionary of user attributes.
In the second case, it will return a generator of repository issue objects,
handling the pagination transparently.
In the second case, it will return a generator of objects, handling
pagination transparently.
It looks a little bit like magic, but it is not. Here is how it works:
Expand Down Expand Up @@ -441,7 +441,7 @@ def v4(self, query, object_path=None, **params):
return

res = self.extract_result(r)
if 'data' not in res:
if 'errors' in res or 'data' not in res:
raise VCSError('API didn\'t return any data:\n' +
json.dumps(res, indent=4))
data = res['data']
Expand Down

0 comments on commit faedab4

Please sign in to comment.