Skip to content
Snippets Groups Projects
Commit 22ffe9d0 authored by Javier Diaz's avatar Javier Diaz
Browse files

Debugging

parent 4371a083
No related branches found
No related tags found
2 merge requests!294Release TeraFlowSDN 4.0,!259Resolve "(CTTC) Replace DLT Gateway functionality with an opensource and Hyper Ledger v2.4+ compliant version"
...@@ -20,5 +20,5 @@ def record_exists(record : DltRecord) -> bool: ...@@ -20,5 +20,5 @@ def record_exists(record : DltRecord) -> bool:
exists = exists and (record.record_id.type != DLTRECORDTYPE_UNDEFINED) exists = exists and (record.record_id.type != DLTRECORDTYPE_UNDEFINED)
exists = exists and (len(record.record_id.record_uuid.uuid) > 0) exists = exists and (len(record.record_id.record_uuid.uuid) > 0)
#exists = exists and (record.operation != DLTRECORDOPERATION_UNDEFINED) #exists = exists and (record.operation != DLTRECORDOPERATION_UNDEFINED)
#exists = exists and (len(record.data_json) > 0) exists = exists and (len(record.data_json) > 0)
return exists return exists
...@@ -93,7 +93,7 @@ async function getFromDlt(call, callback) { ...@@ -93,7 +93,7 @@ async function getFromDlt(call, callback) {
try { try {
console.log("RECEIVED CALL REQUEST:", call.request); console.log("RECEIVED CALL REQUEST:", call.request);
const { record_uuid } = call.request; //const { record_id, operation, data_json } = call.request;
const resultBytes = await contractInstance.evaluateTransaction('RetrieveRecord', JSON.stringify(call.request)); const resultBytes = await contractInstance.evaluateTransaction('RetrieveRecord', JSON.stringify(call.request));
// Decode and parse the result // Decode and parse the result
const resultJson = utf8Decoder.decode(resultBytes); const resultJson = utf8Decoder.decode(resultBytes);
...@@ -105,7 +105,12 @@ async function getFromDlt(call, callback) { ...@@ -105,7 +105,12 @@ async function getFromDlt(call, callback) {
if (error.message.includes("data not found for key")) { if (error.message.includes("data not found for key")) {
// Return an empty response when no record is found // Return an empty response when no record is found
console.log("REQUEST ERROR:", error); console.log("REQUEST ERROR:", error);
callback(null, { record_id: call.request, data_json: "" }); const emptyRecordId = {
domain_uuid: { uuid: "" },
type: 'DLTRECORDTYPE_UNDEFINED',
record_uuid: { uuid: "" }
};
callback(null, { record_id: emptyRecordId, data_json: "" });
} else { } else {
// Send failure response with error message // Send failure response with error message
callback({ callback({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment