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
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -101,7 +101,8 @@ async function getFromDlt(call, callback) {

    // Send the response with the formatted JSON data
    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
    callback(null, { record_id: call.request, data_json: "{}" });
  } else {
@@ -112,6 +113,7 @@ async function getFromDlt(call, callback) {
    });
   }
  }
}

// Implement subscription to DLT events