on 03-10-2016 6:02 PM
Hello,
I'm using OData Model with TwoWay binding and after I change something I call the method submitChanges().
I'm expecting an error because of the eTag verification.
The problem is that the error occur but the callback function is always success.
If you open the OData object, you will see the expected error response 412, but it is considered success in general.
I want to show a MessageBox when this error occurs, but the response is always success even with this error.
Hou can I proceed?
Thanks in advance,
Henrique Schorr
Hi Henrique,
I have the exact same problem. Did you solve this issue in meantime? My submitChanges always result in executing the 'success' callback function.
Kind Regards,
Nico van der Linden
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Nico,
No one answered and I was unable to find a default solution. So here it is what I did:
A loop in the batchResponse looking for errors.
for (var i = 0; i < oData.__batchResponses.length; i++) {
oResponse = oData.__batchResponses[i].response;
if (typeof oResponse !== "undefined" && oResponse.statusCode === "412") {
this.showDataInconsistency();
break;
}
}
Best regards,
Henrique Schorr
Hi Henrique,
Thanks for your reply, in meantime I indeed did something similar. And it seems to work for me as well.
I get a __batchResponses array back through the 'success' call back function of submitChanges which always contains two entries. __batchResonses[0] contains the error (if there was an error) and __batchResponses[1] is always correct.
Did you have the same finding? I started with a for loop as well but since I noticed that the error response is always in the first array item I just looked directly for an undefined or response Higher then 299 to be sure that an error occurred.
Regards,
Nico
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.