You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.
When providing an incorect request body, the error messge is not descriptive enough.
Example:
from typeform import Typeform
r = Typeform("XXXXXXXX").forms.create(data={
"title": "Incorrect form payload",
"type": "quiz",
"theme": https://api.typeform.com/themes/GKFi5U"
})
Raises the following exception:
...
File ~/Projects/coef/typeform-python-sdk/typeform/client.py:41, in Client.__validator(self, result)
39 if type(body) is dict and body.get('code', None) is not None:
40 print(body)
---> 41 raise Exception(body.get('description'))
42 elif result.status_code >= 400:
43 raise Exception(result.reason)
Exception: The payload is invalid.
If you are to intercept the HTTP response, you will receive a much more verbose error message:
{
"code": "VALIDATION_ERROR",
"description": "The payload is invalid.",
"details": [
{
"code": "WRONG_TYPE",
"description": "should be object,null",
"field": "/theme",
"in": "body"
}
]
}
Motivation for or Use Case:
I'd like to handle errors better and understand where the issue is
Related Issues - has a similar issue been reported before?:
# in typeform/client.py L39:
if type(body) is dict and body.get('code', None) is not None:
print(f"Error code: {body.get('code')}")
print(f"Error details: {body.get('details')}")
raise Exception(body.get('description'))
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Description:
When providing an incorect request body, the error messge is not descriptive enough.
Example:
Raises the following exception:
If you are to intercept the HTTP response, you will receive a much more verbose error message:
Motivation for or Use Case:
I'd like to handle errors better and understand where the issue is
Related Issues - has a similar issue been reported before?:
#16 Invalid payload error when creating a new Typeform
Environment Configuration:
Latest revision at: ccfe1ec
Suggest a Fix:
The text was updated successfully, but these errors were encountered: