Friday, October 28, 2011

Error codes: when are they actually set?

The function PrintFAErrno() displays the current value of FA_errno not as a number but as a constant. This is convenient in understanding what went wrong in your code.

I did a little experimenting and found some surprising results. If I give the following correct code, I get an error code of FE_Success as expected.

var doc = app.ActiveDoc.FirstPgfInDoc;
PrintFAErrno();


If I change my code as shown below, I expect a non-zero error code as documents do not have the property NextPgfInDoc. (That is a paragraph property.) My tests show, however, that FA_errno remains FE_Success.

var doc = app.ActiveDoc.NextPgfInDoc;
PrintFAErrno();

So what is going on? I am not quite sure. While I distinctly recall seeing actual error codes as I developed other examples, I find that right now I am unable to get anything other than FE_Success. My error? ESTK problem? I fear I have made some subtle mistake. I will be keeping this issue in mind as I go forward and will report on my findings.


2 comments:

  1. Hi Debra, What you actually have is a syntax error in your script, not a method error. The error codes get triggered when a method fails, but not for syntax errors. Did the ExtendScript Toolkit complain about the improper syntax?
    --Rick

    ReplyDelete
  2. Hi Rick,

    I do not see a syntax error. My thinking is very influenced by what I am used to seeing in the FDK. I was excepting BadPropNum as an indication that object in question does not have the property named.

    ReplyDelete