Link to home
Start Free TrialLog in
Avatar of anas_madani
anas_madani

asked on

handling unknown exceptions

my prog raises an unknown exception and then become unstable any advice ?

I have the following parts in it:

-a thread that checks a SQL table every second
- serial port component ( from varian software)
- stored procedure that update/check tha data
-two timers : one for sending acknowledgement , another for checking recieved data END.
 

Note:
 it may takes several times before raising th exception
.

ReGaRdS
Anas
Avatar of ckaneta
ckaneta

put the code that causes the exception in a try..except block.
you can do
try
 some stuff
except do
 some stuff on any exception


Avatar of anas_madani

ASKER

appricheate your guick comment.

I don't even know the part that causes the exception, I only got a message says
: Unknown exception at memory address :xxxxxx




AnAs
okay from there I'd set breakpoints before you check the table, and also
before you call the stored procedure to
see if we can determine where the exception gets raised.  once you figure that out, let us know and we'll see if we can't be of more help

luck
carl
I agree with ckanteta. Try this:

procedure TMyThread.Execute;
begin
  try
//    somestuff here
  except
    on e: Exception do
    begin
      e.Message:=e.Message+' raised in TMyThread';
      raise;
    end;
  end;
end;

procedure TAnyForm.OnTimer(Sender: TObject);
begin
  try
//    somestuff here
  except
    on e: Exception do
    begin
      e.Message:=e.Message+' raised in TAnyForm.OnTimer';
      raise;
    end;
  end;
end;

And so on...


Reagards, ptm.

Have you tried using ApplicationEvents' OnException? The sender parameter should tell you where the Exception is being raised. The Exception paramter of course will tell what the exact exception is and GetLastError should give you more background into that error.


Good luck!!
 
I've tried the Application On exception event and I still having the message:


The Exception unknown software exception [0x0eedfade] occurred in the application at location 0x6591d445 !


It hurts .


AnAs
to pinpoint strange exceptions, put this in EVERY procedure/function (or in every proc where you expect the error to be in) :



var
  errstring:string;
Begin
  errstring:='';
  try
    errstring:='before something something';
    //one line of orginal code <HERE>
    errstring:='some comment';
    //on line of orginal code <HERE>
    errstring:='some other comment';
    //on line of orginal code <HERE>
    //etc, etc
  except
   on e:exception do
      showmessage(e.message+': '+ErrString);
  end;
end;


Hope this helps to pinpoint the prob. If the problem is just not catched, i suggest you download MemProof (http://www.listsoft.ru/eng/programs/pr1520.htm , forgot the orginal site's url) . Maybe with that very cool program you can discover you error(s).

Good luck :)


-Rover
ASKER CERTIFIED SOLUTION
Avatar of Freaky
Freaky

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial