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

Using Submit operations with multiple tables that are nested isn't retrieving errors #281

Open
W1nstar opened this issue Jul 9, 2020 · 0 comments

Comments

@W1nstar
Copy link

W1nstar commented Jul 9, 2020

When the response from the server is nested, and you're using submit = true, the _mergeUpdateForSubmit function triggers on a successful request.

When this function reads the JSON the server has answered with, it is only accessing first-level tables, therefore it isn't retrieving errors server is returning in child tables, deeming operations as successful.

JSDO/src/progress.js

Lines 5525 to 5551 in 319202b

var dataSetJsonObject = jsonObject[this._dataSetName];
if (dataSetJsonObject[this._dataSetName])
dataSetJsonObject = dataSetJsonObject[this._dataSetName];
var beforeJsonObject = dataSetJsonObject["prods:before"];
for (var buf in this._buffers) {
var tableRef = this._buffers[buf];
var tableJsonObject = dataSetJsonObject[tableRef._name];
if (tableJsonObject instanceof Array) {
for (var i = 0; i < tableJsonObject.length; i++) {
var recordId = tableJsonObject[i]["prods:clientId"];
if (!recordId) {
throw new Error(msg.getMsgText("jsdoMSG035", "_mergeUpdateForSubmit()"));
}
// Determine if error string (get prods_id before _mergeUpdateRecord() is called,
// since it removes all prods properties)
errorString = undefined;
if (tableJsonObject[i]["prods:hasErrors"]) {
var prods_id = tableJsonObject[i]["prods:id"];
errorString =
this._getErrorStringFromJsonObject(dataSetJsonObject, tableRef, prods_id);
}

Here, dataSetJsonObject holds a NESTED dataSet, so only one table is present, rest are nested inside:

var tableJsonObject = dataSetJsonObject[tableRef._name];

Only table is gonna see error processing is the initial table, while errors may occur on child tables.

Is there any workaround for this? useRelationships does nothing in this scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant