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
anas_madaniAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ckanetaCommented:
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


0
anas_madaniAuthor Commented:
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
0
ckanetaCommented:
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
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

ptmcompCommented:
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.
0
DrDelphiCommented:

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!!
 
0
anas_madaniAuthor Commented:
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
0
deroverCommented:
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
0
FreakyCommented:

I have made some practise with serial comm and threads and so on ..

My experience is that the only way to make the app stable is to NOT use timers.

Use loops and let windows handle the timeouts ..

(I guess that your app calls a still running function again (perhaps from the component you use) and causes the exception - you probably won't be able to locate it by tracing though 'cause you can't stop the comm-timeouts)

Greets

 Sascha
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.