Skip to content

Commit b9eef14

Browse files
Lucas Mendes Mota da Fonsecasmaeda-ks
authored andcommitted
Add validation on Error class (#233)
* Add SEGMENTATION_TYPE to enum * validate if index is on list index to prevent erros
1 parent 891b923 commit b9eef14

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

twitter_ads/error.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __str__(self):
4141
@staticmethod
4242
def from_response(response):
4343
"""Returns the correct error type from a ::class::`Response` object."""
44-
if response.code:
44+
if response.code and response.code in ERRORS:
4545
return ERRORS[response.code](response)
4646
else:
4747
return Error(response)

0 commit comments

Comments
 (0)