Copy link to clipboard
Copied
I have a script that does the following:
The function returns a FA_errno of -3, which is fine because I was using the ObjectValid method to iterate through the paragraphs so eventually the object will be invalid. My problem is that I cannot override the error code after I exit that funciton. The FA_errno stays set to negative 3. Am I missing something or are there situations that forbid you from overriding the error code?
The relevant code is as follows:
var vDoc=app.ActiveDoc;
var vFlowArray=new Array();
var vFirstPgf=vDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;
getPgfList (vFirstPgf, vFlowArray);
//due to getPgfList function, the FA_errno is -3 so i am going to overwrite the code
FA_errno=Constants.FE_Success
while (FA_errno==Constants.FE_Success)
//a bunch of stuff occurs in the while condition but i am not showing it because this never evaluates to true
function getPgfList (pPgf,pArray)
{
while (pPgf.ObjectValid())
{
pArray.push (pPgf);
pPgf=pPgf.NextPgfInFlow;
}
}
Copy link to clipboard
Copied
I've reproduced this bug on my own machine. In fact, in my limited testing, I did not find any situations where I could explicitly initialize FA_errno. Hopefully this gets fixed soon.
A workaround, admittedly not the most elegant, could be to call a method with no side-effects that will reset the code for you, e.g.,
function initFA_errno()
{
app.GetNamedMenu("!MakerMainMenu"); //If this fails, you've got bigger problems
return;
}