Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space FUNCTDEV and version SVC2026.2

...

  1. Add a throw statement to your Document Repository CRUD Tool script in the format:
    Code Block
    throw "<httpStatusCode>_<errorMessage>";
    For example:
    Code Block
    var item = db.items.findOne({ id: 1 })
    if (item == null) {
      throw "404_Item does not exist";
    }
    Virtualize will put the HTTP status code and the error message into variables named crudToolErrorCode and crudToolErrorMessage.
  2. Go to the Document Repository CRUD Tool's parent responder and confirm that Continue searching for a matching responder if data source correlation fails is enabled under Failover Options in the Data Source Correlation tab.
  3. Add a new responder to the asset and in the Request Correlation tab, add an xpath on the Request Body like:
    "404" = "${crudToolErrorCode}"
    This will capture the request that failed over from the earlier responder. You can configure this responder further, just like any other responder. For example, you could configure the Return Status under the Options tab to use the variable crudToolErrorCode as the HTTP response code. 

    See Message Responder Overview for more information about configuring responders.