Dynamically check if exception in exception filters

delphi package - automated exception handling

Dynamically check if exception in exception filters

Postby maggigisla » Thu Mar 30, 2017 6:28 pm

Hi ...
Is there a way for me to check if given exception that was raised is in the exception filters in the settings window ?
maggigisla
 
Posts: 9
Joined: Fri May 20, 2011 2:56 pm

Re: Dynamically check if exception in exception filters

Postby madshi » Thu Mar 30, 2017 6:38 pm

You can use "exceptIntf.Filter1Classes" or "Filter2Classes" to ask the list of classes in the settings window. And you can use "exceptIntf.ExceptClass" to get the class name of the current exception. With all that information, you can simply check if the current exception class is listed in either Filter1Classes or Filter2Classes.
madshi
Site Admin
 
Posts: 9473
Joined: Sun Mar 21, 2004 5:25 pm

Re: Dynamically check if exception in exception filters

Postby maggigisla » Fri Mar 31, 2017 12:50 pm

Hi ...

I see the exceptIntf.ExceptClass property but not exceptIntf.Filter1Class or exceptIntf.Filter2Class, are they private ?
maggigisla
 
Posts: 9
Joined: Fri May 20, 2011 2:56 pm

Re: Dynamically check if exception in exception filters

Postby madshi » Fri Mar 31, 2017 12:58 pm

Does the compiler complain?
madshi
Site Admin
 
Posts: 9473
Joined: Sun Mar 21, 2004 5:25 pm

Re: Dynamically check if exception in exception filters

Postby maggigisla » Fri Mar 31, 2017 1:31 pm

exceptIntf.Filter2Classes;
[dcc32 Error] main.pas(795): E2003 Undeclared identifier: 'Filter2Classes

Yes he does :)
maggigisla
 
Posts: 9
Joined: Fri May 20, 2011 2:56 pm

Re: Dynamically check if exception in exception filters

Postby madshi » Fri Mar 31, 2017 1:45 pm

Hmmmm, ok, then try using "MESettings().Filter2Classes" instead of "exceptIntf.Filter2Classes".
madshi
Site Admin
 
Posts: 9473
Joined: Sun Mar 21, 2004 5:25 pm

Re: Dynamically check if exception in exception filters

Postby maggigisla » Fri Mar 31, 2017 1:52 pm

Just to be sure that I'm not telling you some bullshit, I'll try to explain my situation again.
I'm inside the OnException event on TMadExceptionHandler.
In my case :
{code}
procedure TfrmMain.adalException(const exceptIntf: IMEException;
var handled: Boolean);
{code}

Here I want to check if the exceptIntf.ExceptClass is in either ExceptionFilter1 og ExceptionFilter2.
Properties Filter1Classes and Filter2Classes are not visible on variable exceptIntf.
Your suggestion to try MESettings() I don't understand, there's no property on the exceptIntf, so I'm not sure what you're telling me :)

Could you please clarify this for me :)
Thanks for quick responses and good service ...
maggigisla
 
Posts: 9
Joined: Fri May 20, 2011 2:56 pm

Re: Dynamically check if exception in exception filters

Postby madshi » Fri Mar 31, 2017 2:03 pm

I'm not sure I understand what you're asking. "MESettings().Filter2Classes" works fine for me. So what's the problem?
madshi
Site Admin
 
Posts: 9473
Joined: Sun Mar 21, 2004 5:25 pm

Re: Dynamically check if exception in exception filters

Postby maggigisla » Fri Mar 31, 2017 2:07 pm

In what scope is MESettings() a valid variable ?

[dcc32 Error] main.pas(795): E2003 Undeclared identifier: 'MESettings'
maggigisla
 
Posts: 9
Joined: Fri May 20, 2011 2:56 pm

Re: Dynamically check if exception in exception filters

Postby madshi » Fri Mar 31, 2017 2:17 pm

It's a function exported by madExcept.pas.
madshi
Site Admin
 
Posts: 9473
Joined: Sun Mar 21, 2004 5:25 pm

Re: Dynamically check if exception in exception filters

Postby maggigisla » Fri Mar 31, 2017 2:32 pm

:)
Now we are talking ..., that's what was missing, add madExecpt.pas to my uses clause ( I thought that madExceptVcl.pas was enough).
Thank you for your support
maggigisla
 
Posts: 9
Joined: Fri May 20, 2011 2:56 pm


Return to madExcept

Who is online

Users browsing this forum: No registered users and 2 guests

cron