3

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

mjn
  • 36,362
  • 28
  • 176
  • 378
opc0de
  • 11,557
  • 14
  • 94
  • 187
  • 3
    In my perceptions some downvoters sometimes just seem to have a bad day. Explaining why they voted often would reveal their identity, which not everyone may like. Anyway, no one asks for a reason for an up vote - so why give one for a down vote? – Uwe Raabe Jan 21 '12 at 13:27
  • I guess the quality of the board would improve if you can see who votes you up or down and persons like that who vote without reason should be blocked... – opc0de Jan 21 '12 at 13:32
  • @opcode: voter anonimity is what ensures fair elections in a democracy. Voter anonimity on SO is what ensures that people can feel free to vote as they like without having to fear repercusions. Which, unfortunately, are only to real here on SO. Tit-for-tat down-voting if you do give a reason is an existing problem. Just get over the fact that someone downvotes a post you made. It happens. That's life. Also, a downvoter usually is long gone and has long forgotten (s)he downvoted a question when you ask for a reason... – Marjan Venema Jan 21 '12 at 14:54
  • What do you mean by "It doesn't work"? If you are running from the IDE and have it set up to break on exceptions, the IDE will still break regardless of what exception handling you have in place. – Marjan Venema Jan 21 '12 at 14:57
  • @MarjanVenema i don't have to explain as i am explaining to a child.I don't think people when are reading "it doesn't work" they think that my fridge is not working...i know how the ide handles errors thanks for the tip probably it's a sock to you but i am not retarded so please don't treat me like one – opc0de Jan 21 '12 at 16:46
  • i don't care for rep and points i only ask why they downvote to edit my question to make it understandable for others as english is not my native language – opc0de Jan 21 '12 at 16:50
  • @opcode: I do not understand why you are reacting so defensively. When somebody says something doesn't work I am afraid my crystal ball doesn't tell me how that manifests itself. I don't know what you know unless you tell me/us. So unless you tell me/us what happens I am going to start with the basics. Wrt the voting: I did not imply that you were worried about your rep. I just meant that it is futile to ask because any downvoter will be long gone when you do. Plus I absolutely do not agree with your wish for non-anonymous voting and tried to explain why. – Marjan Venema Jan 21 '12 at 18:06

2 Answers2

9

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.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
4

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.

Uwe Raabe
  • 45,288
  • 3
  • 82
  • 130
  • I don't know - I usually don't use this feature. – Uwe Raabe Jan 21 '12 at 13:40
  • 2
    +1 This is the right answer. madExcept is not a substitute for having a propert top-level exception handler. – David Heffernan Jan 21 '12 at 13:44
  • 2
    @DavidHeffernan my problem is that the components give an exception when they are initalized and i am not creating them dinamicly any way it's a faster method making a filter that put try and except blocks every where in the code ... – opc0de Jan 21 '12 at 13:49