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

Return empty value if there are no records match a key

parent 9ee1f5ca
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"
...@@ -101,7 +101,8 @@ async function getFromDlt(call, callback) { ...@@ -101,7 +101,8 @@ async function getFromDlt(call, callback) {
// Send the response with the formatted JSON data // Send the response with the formatted JSON data
callback(null, { record_id: call.request, data_json: JSON.stringify(result) }); callback(null, { record_id: call.request, data_json: JSON.stringify(result) });
} catch (error) { if (error.message.includes("data not found for key")) { } catch (error) {
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
callback(null, { record_id: call.request, data_json: "{}" }); callback(null, { record_id: call.request, data_json: "{}" });
} else { } else {
...@@ -110,6 +111,7 @@ async function getFromDlt(call, callback) { ...@@ -110,6 +111,7 @@ async function getFromDlt(call, callback) {
code: grpc.status.UNKNOWN, code: grpc.status.UNKNOWN,
details: error.message details: error.message
}); });
}
} }
} }
......
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