Scripting errors (TS2332 and PDF error: ENONT)

Post Reply
Arsen
Newbie
Posts: 5
Joined: Fri Apr 10, 2020 11:08 pm

Scripting errors (TS2332 and PDF error: ENONT)

Post by Arsen »

1. What is this and where I can find relevant script?
Screenshot 2023-04-18 at 15.54.44.png
Screenshot 2023-04-18 at 15.54.44.png (59.52 KiB) Viewed 7941 times

2. The first time the script works fine, the second time it gives an error.
I took the script from GitHub repository and did not change it.
Screenshot 2023-04-18 at 16.08.17.png
Screenshot 2023-04-18 at 16.08.17.png (81.48 KiB) Viewed 7941 times

Where should I look for the problem and a solution?
Screenshot 2023-04-18 at 15.59.37.png
Screenshot 2023-04-18 at 15.59.37.png (195.21 KiB) Viewed 7941 times
laurentd
Member
Posts: 142
Joined: Wed Mar 13, 2019 2:06 pm

Re: Scripting errors (TS2332 and PDF error: ENONT)

Post by laurentd »

Hi Arsen,

This problem happens because the second time the job is processed, Switch fails to add the dataset with the same name. It does not replace it by default. 2 solutions:
  • use Export metadata and remove the dataset before processing the job a second time
  • edit the script and remove the dataset before adding it:

Code: Select all

        try {
            await job.removeDataset(datasetName);
            // await job.log(LogLevel.Debug, `Removed dataset '${datasetName}'`);
        } catch (error) {
            // dataset does not exist
            // await job.log(LogLevel.Debug, `Dataset '${datasetName}' did not exist`);
        }
Laurent De Wilde, Solution Architect @ Enfocus
Arsen
Newbie
Posts: 5
Joined: Fri Apr 10, 2020 11:08 pm

Re: Scripting errors (TS2332 and PDF error: ENONT)

Post by Arsen »

Thanks a lot, Laurent. I can handle it from here.
Post Reply