Skip to content

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

@W1nstar

Description

@W1nstar

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions