Error Population
Closed this issue · 2 comments
AlanFoster commented
Currently when asking a model for its errors, No result returned
is being returned, instead of a list of known errors.
Example Scenario
- A zuora account has been created with a missing state field
- A further update is made to activate the account
Request Payload
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:zns="http://api.zuora.com/" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ins0="http://api.zuora.com/" xmlns:ins1="http://object.api.zuora.com/"
xmlns:ins2="http://fault.api.zuora.com/">
<env:Header>
<SessionHeader>
<session>
...
</session>
</SessionHeader>
</env:Header>
<env:Body>
<ins0:update>
<ins0:zObjects xsi:type="ins0:Account">
<ins1:Id>Foo</ins1:Id>
<ins1:Status>Active</ins1:Status>
</ins0:zObjects>
</ins0:update>
</env:Body>
Response Payload
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns1:updateResponse xmlns:ns1="http://api.zuora.com/">
<ns1:result>
<ns1:Errors>
<ns1:Code>MISSING_REQUIRED_VALUE</ns1:Code>
<ns1:Message>Taxation Requirement: State is required for Sold To Contact if the country is United States or
Canada.
</ns1:Message>
</ns1:Errors>
<ns1:Success>false</ns1:Success>
</ns1:result>
</ns1:updateResponse>
</soapenv:Body>
</soapenv:Envelope>
Problem
When asking model.errors.full_messages
the result is ["No result returned."]
Expected
The error message Taxation Requirement: State is required for Sold To Contact if the country is United States or Canada
should be present within `model.errors.
Investigation
The default error message seems to be populated here, as the results
object does contain an id
field, and is therefore not being populated correctly.
Within this context action
is set to :update
and results
is set to
[
{
"errors": {
"code": "MISSING_REQUIRED_VALUE",
"message": "Taxation Requirement: State is required for Sold To Contact if the country is United States or Canada."
},
"success": false
}
]
It would be great to add and handle this use edge-case :)
acarr-shopkeep commented
+1