Friday, 11 April 2025

Filled under:

- type: javascript

  name: process_replica_list_custom

  script: |

    try {

      // Initialize an empty variable for the replica list.

      let replicaList = "";


      // Check for the existence of each variable and use the first non-empty one.

      if (typeof replica_list_V1 !== "undefined" && replica_list_V1) {

        replicaList = replica_list_V1;

      } else if (typeof replica_list_V2 !== "undefined" && replica_list_V2) {

        replicaList = replica_list_V2;

      } else if (typeof replica_list_V3 !== "undefined" && replica_list_V3) {

        replicaList = replica_list_V3;

      }

      

      // If none of the variables are found or non-empty, throw an error.

      if (!replicaList) {

        throw new Error("None of the expected replica_list variables were found.");

      }

      

      // Proceed to the next state with the found replica list,

      // using the custom js_lib function.

      js_lib.proceed("Replica list found. Proceeding to next state.", { replicaList: replicaList });

    } catch (err) {

      // Catch any error and fail this state using the custom js_lib function.

      js_lib.fail("Error encountered: " + err.message);

    }


0 comments:

Post a Comment