Page 1 of 1

Illustrator script error sometimes not defined

Posted: Mon Aug 10, 2020 7:37 am
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); 

    }
}

Re: Illustrator script error sometimes not defined

Posted: Mon Aug 10, 2020 9:11 am
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.

Re: Illustrator script error sometimes not defined

Posted: Mon Aug 10, 2020 11:31 am
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.

Re: Illustrator script error sometimes not defined

Posted: Mon Aug 10, 2020 11:44 am
by freddyp
Sorry, it is indeed $status and not $error.