labd / commercetools-python-sdk

Commercetools Python SDK
https://commercetools-python-sdk.readthedocs.io/en/latest/
MIT License
17 stars 16 forks source link

400 InvalidField errors give marshmallow error instead of raising CommercetoolsError #101

Closed davidweterings closed 4 years ago

davidweterings commented 4 years ago

Example response:

{"statusCode":400,"message":"The value \'49136\' is not valid for field \'sapCode\'. ","errors":[{"code":"InvalidField","message":"The value \'49136\' is not valid for field \'sapCode\'. "}]}

The reason is because in _schemas/_error.py line 502 an invalid schema is used:

marshmallow.fields.Nested( nested="commercetools.schemas.None.anySchema", unknown=marshmallow.EXCLUDE, allow_none=True, ), This happens a few more times in nested lists with unknown types.