[fpc-pascal] EInvalidOp Excpetion

Antonio Sanguigni a.sanguigni at gmail.com
Fri Dec 5 17:01:02 CET 2008


Hi all,

since fpc 2.2.3 in my Arch Linux box I'm having some troubles with an
EInvalidOp exception raised on normal math operations. I tried to
update to 2.3.1 but with the same result. I found in the bug tracker
an opened bug, about this kind of exception and I tried to use
ClearExceptions and trapping the code block in a try..except block and
this is fine but the error move on another block of my code. Trapping
this too, it moves on synapse library code so I believe there is a
problem I cannot solve. Could you guys point me to the right direction
to solve this errors ?

Thank you.

Follows a my code block:
-------------------------------------
procedure TFileToFtp.Update(ASubject: TtiObject);
var
  TempSpeed: double;
begin
  inherited Update(ASubject);
  begin
    FTransferBytes:= FTransferBytes +
TMultiFTP(ASubject).WrittenBytes; //total transferred bytes
    FTransferPercentage := RoundTo(fTransferBytes / fSize * 100, -2);
    try
      TempSpeed := (TMultiFTP(ASubject).WrittenBytes/SecondSpan(Time,
fTime))/1024;
      fTransferSpeed := TempSpeed;
    except
      //do nothing to capture division by zero
      //and keep previous fTransferSpeed value ;-)
    end;
    fTime := Time; // <========== *HERE I HAVE EInvalidOp, but if I
trap this I got on the first two rows after begin statement and if I
trap all the block I have it in another code block*
    writeln(FloatToStr(RoundTo(fTransferPercentage, -4)) + '%');
    writeln(FloatToStr(RoundTo(fTransferSpeed, -4)) + ' Kb');
    writeln('Pacchetto: ' + IntToStr(TMultiFTP(ASubject).WrittenBytes));
  end;
end;
----------------------------

Antonio


--
Antonio Sanguigni alias slapshot
----------------------------------------------------------------------
GioveLUG (Linux User Group) - http://www.giovelug.org
Edupup (Educational distro) - http://www.pieroni.biz/edupup



More information about the fpc-pascal mailing list