Error Checking

How are you doing your batchPlay error checking.

For example, in one of my batchPlay recordings, I hide a Layer based on it’s name.

Now I would like to show a message box if that Layer Name does not exist for example.

I am interested to hear from others how they are dealing with error checking for situations like this

{
         "_obj": "hide",
         "null": [
            {
               "_ref": "layer",
               "_name": "Brightness"
            }
         ],
         "_isCommand": true,
         "_options": {
            "dialogOptions": "dontDisplay"
         }
      },

surround the batchPlay with try/catch
or debug the result of batchPlay

const result = await batchPlay()
console.log(result)

I was under the impression try/catch did not show an alert type message box.

Hi.

You can try to check if the layer is existing befor you will run the batchplay.
If it is not exists you can show an error…

That sounds pretty feasible to me. I think I shall go down that route

u must declare ur own alert if u wanna show it

try{
 //batchplay routine
}catch(error){
 await require("photoshop").app.showAlert("Sumthin aint rite!!");
}