• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Are there situations where you can NOT override the FA_errno's code?

Participant ,
Feb 14, 2012 Feb 14, 2012

Copy link to clipboard

Copied

I have a script that does the following:

  1. creates an array
  2. calls a function that populates the array with a list of paragraphs in the FrameMaker document
  3. executes a while loop that then process this array. The while loops conditional is FA_errno==Constants.FE_Success.

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;

        }

         }

TOPICS
Scripting

Views

787

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 15, 2012 Feb 15, 2012

Copy link to clipboard

Copied

LATEST

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;

         }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines