Raise Exception (throw error) step

Asked Claude to make one for me.
Seems to work :smiley:
throw-error.hjson:

[
  {
    "type": "throw_error",
    "module": "throw-error",
    "action": "throwError",
    "groupTitle": "Error Handling",
    "groupIcon": "fas fa-lg fa-exclamation-triangle comp-exec",
    "title": "Throw Error",
    "icon": "fas fa-lg fa-exclamation-circle comp-exec",
    "properties": [
      {
        "group": "Error",
        "variables": [
          {
            "name": "actionName",
            "optionName": "name",
            "title": "Name",
            "baseName": "error",
            "type": "text",
            "required": true,
            "defaultValue": ""
          },
          {
            "name": "message",
            "optionName": "message",
            "title": "Error Message",
            "type": "text",
            "required": true,
            "defaultValue": "",
            "serverDataBindings": true,
            "help": "The error message to throw"
          }
        ]
      }
    ]
  }
]

throw-error.js:

// JavaScript Document

exports.throwError = async function (options) {
    options = options || {};
    const message = options.message || "Custom error thrown from the extension.";
    throw new Error(message);
};
3 Likes