Skip to content

Commit

Permalink
Add validation on Error class (#233)
Browse files Browse the repository at this point in the history
* Add SEGMENTATION_TYPE to enum

* validate if index is on list index to prevent erros
  • Loading branch information
Lucas Mendes Mota da Fonseca authored and smaeda-ks committed Nov 29, 2019
1 parent 891b923 commit b9eef14
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion twitter_ads/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __str__(self):
@staticmethod
def from_response(response):
"""Returns the correct error type from a ::class::`Response` object."""
if response.code:
if response.code and response.code in ERRORS:
return ERRORS[response.code](response)
else:
return Error(response)
Expand Down

0 comments on commit b9eef14

Please sign in to comment.