how to understand the string returned by try/catch block.

Sarah Reichelt sarah.reichelt at gmail.com
Sun Oct 22 01:05:13 EDT 2006


On 10/22/06, Andre Garzia <soapdog at mac.com> wrote:
> Friends,
>
> when using a try/catch block to pick errors, I usually see stuff like
> this in the errorStatement:
>
> 91,81,2
> 77,81,2
> 223,81,1
> 241,81,1,getCountriesForm
> 353,0,0,stack "script"
> 219,31,36,getCountriesForm
> 499,31,1
> 253,27,1
>
> Does anyone know how to make sense of it? For example I know that
> stack "script" means the revolution script that I am using for CGI. I
> also know that the second item of each line is a line number since
> function getCountriesForm is on line 81 and it is called on line 31
> (when the thing explodes). I can't make sense of the first item of
> each line or the third. I though it might be char number, but it
> ain't because there's nothing special in char 36 of line 31....
>
> can anyone tell me more about it? This is what I could grok on my own.


Hi Andre,

Here is the function I use. I didn't write it and I forget who did,
but I'm very grateful to them :-)

function parseError pErrContents
  put item 4 of the last line of pErrContents into lObject
  put the number of lines in pErrContents into lNumLin
  if lNumLin > 100 then delete line 100 to lNumLin of pErrContents
  if lNumLin < 2 or the number of items in pErrContents < 6 then
    put "thrown error" & CR into lErrorString
  end if
  put the cErrorsList of cd 1 of stack "REVErrorDisplay" into errorNames
  repeat with i = the number of lines in pErrContents down to 1
    get item 1 of line i of pErrContents
    put line it of errorNames into tlErrMsg
    if tlErrMsg is "Object Name:" then
      put item 4 of line i of pErrContents into tlObject
      -- put the long name of tlObject into tlObjectName
      put tlObject into tlObjectName
    else
      if item 2 of line i of pErrContents is not 0 then
        put item 2 of line i of pErrContents into tlLnr
        put item 3 of line i of pErrContents into tlColumn
      end if
      put CR & "Error description: " & tlErrMsg & CR & \
          "Object: " & tlObjectName & CR & \
          "Line:  " & tlLnr & "      Column:  " & tlColumn & \
          "      Processing Token: " & (item 4 of line i of
pErrContents) & CR before lErrorString
    end if
  end repeat
  if first char of lErrorString = CR then delete first char of lErrorString
  if last char of lErrorString = CR then delete last char of lErrorString
  return lErrorString
end parseError

Cheers,
Sarah



More information about the Use-livecode mailing list