Getting error message when playing all actions recorded from UXP button clicks in Ps Beta v25.9.0

Investigating…

Edited js to get it working in UDT Playground

document.getElementById(“buttonACTIONFROMUXP”).addEventListener(“click”, async() => {

try {
    // record function as an action and pass required variables.
    require('photoshop').action.recordAction(
        {"name": "New Layer", "methodName": "myNewLayer"}, {"MyLayerName": "New Layer from action", "historyStateName": "Run My Action"}
    );
} catch (e) {}

//Run the action associated with the button when the button is clicked and pass the necessary variables
//First variable is an empty object but could potentially be: {"mode":"action","uiMode":"never","hostControl":{}}
await myNewLayer({"uiMode":"test"}, {"MyLayerName": "New Layer from click",  "historyStateName": "New Layer From Click"});

});

//adding function in global scope.
window.myNewLayer = myNewLayer;

async function myNewLayer(executionContext, info) {
const app = require(‘photoshop’).app;
try {await require(‘photoshop’).core.executeAsModal(targetFunction, {“commandName”: “Progress…”, “interactive”: true});}
catch(e) {
if (e.number == 9) {require(‘photoshop’).core.showAlert(“Some other plugin is using Photoshop!”);}
else {
//THIS IS WHERE THE ERROR MESSAGE IS BEING GENERATED!
require(‘photoshop’).core.showAlert(e)
}
}

async function targetFunction(executionControl, string) {

    let hostControl = executionControl.hostControl;
    let documentID = await app.activeDocument._id;
    let suspensionID = await hostControl.suspendHistory({ "name": info.historyStateName, documentID  });

    ///////////////////// Start modal execution /////////////////////        
            
    await require('photoshop').action.batchPlay([
        //Make new layer
        { "_obj": "make", "_target": [ { "_ref": "layer" } ]},
    ], {}).then(result => {console.log(result)}, error => {console.log(error)});        
    
    ///////////////////// Stop modal execution /////////////////////

    await hostControl.resumeHistory(suspensionID);
    } // end targetFunction()  

};