Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error response cannot be parsed #134

Open
tleguijt opened this issue Oct 27, 2021 · 0 comments
Open

Error response cannot be parsed #134

tleguijt opened this issue Oct 27, 2021 · 0 comments
Labels
triage Needs triage

Comments

@tleguijt
Copy link
Contributor

Tested version: 14.0.0b12

Problem
commercetools SDK raises an Exception (no CommercetoolsError) because it cannot parse an error response from commercetools;

Could not parse error response
This is due to a validation error:

{'errors': {0: {'actionIndex': ['Unknown field.'], 'action': ['Unknown field.']}}}

In the following block:

        try:
            obj = ErrorResponseSchema().loads(response.content)
        except ValidationError:
            raise Exception(f"Could not parse error response: {response.content}")

Example response:

b'{"statusCode":400,"message":"A value is required for field \'contract\'.","errors":[{"code":"RequiredField","message":"A value is required for field \'contract\'.","action":{"action":"setCustomField","name":"someCustomField","value":"24e3565c-9135-ec11-a459-6045bd8b7265"},"actionIndex":1,"field":"contract"}]}'
@demeyerthom demeyerthom added the triage Needs triage label Aug 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Needs triage
Projects
None yet
Development

No branches or pull requests

2 participants