Illustrator script error sometimes not defined

Post Reply
PdFUser5000
Member
Posts: 120
Joined: Fri Jun 12, 2020 11:23 am

Illustrator script error sometimes not defined

Post by PdFUser5000 »

This is my error reporting code. Sometimes i get the error: Adobe Illustrator: Error 2: error is undefined. Line: 270 -> $status = error;
I can get pass this by temporary adding var error into catch (e). But after awhile when i delete it the script starts working correctly again. Why is this happening?

Code: Select all

if($error==null)
{
    try {
        start();
    }
    catch (e)  {
        //var error 
        $error = e.description; 
        $status = error;
        doc.close(SaveOptions.DONOTSAVECHANGES); 

    }
}
freddyp
Advanced member
Posts: 1008
Joined: Thu Feb 09, 2012 3:53 pm

Re: Illustrator script error sometimes not defined

Post by freddyp »

Granted, the documentation does not specify it specifically, but it seems logical that the content of $error has to be a string:

Code: Select all

$error = "error";
and on the next line it has to be $doc instead of doc.
PdFUser5000
Member
Posts: 120
Joined: Fri Jun 12, 2020 11:23 am

Re: Illustrator script error sometimes not defined

Post by PdFUser5000 »

freddyp wrote: Mon Aug 10, 2020 9:11 am Granted, the documentation does not specify it specifically, but it seems logical that the content of $error has to be a string:

Code: Select all

$error = "error";
and on the next line it has to be $doc instead of doc.
$status = "error"; should be correct then? not $error = "error"; ,based on your last sentence.
freddyp
Advanced member
Posts: 1008
Joined: Thu Feb 09, 2012 3:53 pm

Re: Illustrator script error sometimes not defined

Post by freddyp »

Sorry, it is indeed $status and not $error.
Post Reply