MadExcept exception filter

1.8k views Asked by At

I am using Delphi XE2 and Mad Except i have an application witch uses Indy for some internet operations ... the problem is that when an simple exception is raised like there is no internet connection madexcept pops up. I want to disable these exceptions witch are coming from indy.

I have the following exception class : EIdSocketError message : Socket Error #11004

I entered in the exception filter dialog in mad except and put EIdSocketError at exception filter but it doesn't work what am i doing wrong ?

enter image description here

2

There are 2 answers

2
Remy Lebeau On BEST ANSWER

The name of the class being raised is EIdSocketError but you set the filter to EIDSocketError instead. Perhaps MadExcept is case sensitive? Also keep in mind that all Indy exceptions are ultimately derived from EIdException so you might want to filter for that instead.

In any case, MadExcept only catches uncaught exceptions, so using try/except blocks in your code is the correct solution. That is how Indy is designed to be used. If you are getting exceptions when the components are being instantiated at runtime during DFM streaming, then you must have left the components in an Active state at design-time. Do not do that. Make sure the components are deactivated at designtime, then activate them in your code at runtime when you are ready to use them.

3
Uwe Raabe On

madExcept will only catch those exceptions that are not handled by your application itself. So a simple try-except block that handles the exceptions in question might be the cleanest solution to your problem.