in jones-ndb/impl/ndb/NdbOperation.js [803:851]
function buildOperationResult(transactionHandler, op, op_ndb_error, execMode) {
udebug.log("buildOperationResult");
/* Summarize Operation Error */
if(op.encoderError) {
udebug.log("Operation has encoder error");
op.result.success = false;
op.result.error = op.encoderError;
} else if(op_ndb_error === null) {
op.result.success = true;
} else {
op.result.success = false;
if(op_ndb_error !== true) { // TRUE here means NdbOperation is null
op.result.error = new DBOperationError().fromNdbError(op_ndb_error);
}
}
/* Handle Transaction Error */
if(execMode !== ROLLBACK) {
if(op.result.success) {
if(transactionHandler.error) {
/* This operation has no error, but the transaction failed. */
udebug.log("Case txErr + opOK", transactionHandler.moniker);
op.result.success = false;
op.result.error = new DBOperationError().cascading(transactionHandler.error);
}
}
else {
/* This operation has an error. */
if(transactionHandler.error) {
udebug.log("Case txErr + OpErr", transactionHandler.moniker);
}
else {
if(op.opcode === opcodes.OP_READ || execMode === NOCOMMIT) {
udebug.log("Case txOK + OpErr [READ | NOCOMMIT]", transactionHandler.moniker);
}
else {
udebug.log("Case txOK + OpErr", transactionHandler.moniker);
transactionHandler.error = new DBOperationError().cascading(op.result.error);
}
}
}
if(op.result.success && op.opcode === opcodes.OP_READ) {
op.result.value = getResultValue(op, op.tableHandler, op.buffers.row, op.blobs);
}
}
if(udebug.is_detail()) { udebug.log("buildOperationResult finished:", op.result); }
}