Closed fusillicode closed 4 years ago
@fusillicode Thank you for opening issue !
The reason is that error response from salesforce is error object array, not object. For example, if we put no exist field to query request, we get the following error.
[ {
"message" : "\nSelect foo FROM Account\n ^\nERROR at Row:1:Column:8\nNo such column 'foo' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.",
"errorCode" : "INVALID_FIELD"
} ]
So I parse it as array that is identical to error response format, however it may be almost single element array.
@tzmfreedom thank you for the quick and exhaustive reply!
Everything is clear now! I was missing the unwrap()
inside the methods and so I was getting confused between the handling of the reqwest errors and the actual SF errors!
Thanks again for all your work and for you invaluable support! 🙇
Cheers!
Hi 😄
First of all thanks really a lot for tall your work on this crate 🙇 .
Sorry for opening this issue but I'm trying to understand the reason behind the usage of
Vec<ErrorResponse>
inside theClient
queries methods.I tried to skim around the code but I wasn't able to figure out the when you're getting a Vec instead of a bare reqwest error and consequently a rustforce
ErrorResponse
.The reason why I'm trying to understand it is because I'm getting some difficulties in handling the type
Vec<ErrorResponse>
instead of a "bare bones"ErrorResponse
and I'm wondering if I just can safely assume that, in case of an Err, I can find it as the first element of the returnedVec<ErrorResponse>
.I hope that my doubts and the the issue I'm facing is clear. If that's not the case please do not hesitate to ask some clarification.
Thanks again!