How can I ignore an exception?

delphi package - automated exception handling

How can I ignore an exception?

Postby Han312 » Tue Jan 28, 2020 10:36 am

For leaks there is a function HideLeak.
Does something similar exist for exceptions?

I would like to ignore TCustomForm.CloseQuery.
Is this possible?
Han312
 
Posts: 46
Joined: Mon Mar 14, 2016 3:49 pm

Re: How can I ignore an exception?

Postby iconic » Wed Jan 29, 2020 9:40 am

Hello,

You can added classes to a filter rule, something as simple as specified here

http://help.madshi.net/madExceptSettings3.htm

--Iconic
iconic
Site Admin
 
Posts: 959
Joined: Wed Jun 08, 2005 5:08 am

Re: How can I ignore an exception?

Postby madshi » Thu Jan 30, 2020 10:46 am

Hmmmm... "TCustomForm.CloseQuery" is not an exception. Can you clarify what you mean exactly?
madshi
Site Admin
 
Posts: 10200
Joined: Sun Mar 21, 2004 5:25 pm

Re: How can I ignore an exception?

Postby Han312 » Mon Feb 03, 2020 9:05 am

We get many exception messages from customers which were caused within of OnFormCloseQuery.

If there are projects which were changed but not saved then we pop up a message to ask what to do.
Now we have customers who have open projects and want to shut down windows.

Or we open a dialog box after starting the program but the user only started the software and then shuts the system down.

The explorer shows them that we expect a customer reaction - but they ignore it and continue to shut down.

It looks then somehow like

Code: Select all
exception message               : Zugriffsverletzung bei Adresse 0000000000000000 in Modul 'MyProgram.exe'. Ausführung von Adresse 0000000000000000.

main thread ($2a70):
00000000 +0000 ???
0167b34b +02cb MyProgram.exe      MyMainFRM       8824  +97 TMyMainForm.FormCloseQuery
00b55e3a +007a MyProgram.exe      Vcl.Forms                TCustomForm.CloseQuery
00b54322 +0012 MyProgram.exe      Vcl.Forms                TCustomForm.WMQueryEndSession


I would like to be able to switch on/off madexcept when FormCloseQuery is called.
Is that possible?
Han312
 
Posts: 46
Joined: Mon Mar 14, 2016 3:49 pm

Re: How can I ignore an exception?

Postby madshi » Mon Feb 03, 2020 9:11 am

Can you reproduce this problem on your development PC? If so, that would be helpful testing how to solve it in the best way.

There are various options:

1) You could call "PauseMadExcept()" at the start of FormCloseQuery(). However, if you do that and an exception occurs, you'll get the standard Delphi exception box.

2) Or you could add a try..except block around your code in FormCloseQuery().

3) Or you could try to actually find the cause of the crash. It looks like line 8824 of your MyMainFRM.pas jumps to a "nil" pointer, for some reason.

Probably there are even more things you could do, but maybe one of those above already helps?
madshi
Site Admin
 
Posts: 10200
Joined: Sun Mar 21, 2004 5:25 pm

Re: How can I ignore an exception?

Postby Han312 » Mon Feb 03, 2020 12:11 pm

The user does not close the software the proper way. Therefore I do not want to invest much time.

So I guess that the least problematic way is to use version 2.
I was so focussed on switching off madexcept that I did not see the most obvious solution. :sorry:
Han312
 
Posts: 46
Joined: Mon Mar 14, 2016 3:49 pm

Re: How can I ignore an exception?

Postby madshi » Mon Feb 03, 2020 12:25 pm

Hehe! Yes, if 2) works for you then yes, it's probably the easiest and "best" solution.
madshi
Site Admin
 
Posts: 10200
Joined: Sun Mar 21, 2004 5:25 pm


Return to madExcept

Who is online

Users browsing this forum: Google [Bot] and 9 guests

cron