Try / Catch

Hi I'm running into my application which is throwing exceptions.  I thought I knew how to handle this apprently I don't.  First let me start out and say that my application is calling a dll and thats where the exception is occuring.

        url = MyForm->CMHTTP->Body;
    catch(...) {
        ShowMessage("Exception caught when I trying to call Servlet");

I'm getting an exception when the Get is done because the address is invalid.  I thought the catch would work?  Whats wrong
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.

C++ Builder automatically catches Exception before your code.

To get the correct comportment, do :
Tools | Debugger Options | Language Exceptions and uncheck "Stop on Delphi Exception" and the other "Stop on..."

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
George TokasCommented:
I have another oppinion if I may...
 First of all we have to know if the exception is displayed and in release mode...
 In debug mode ALLWAYS the exception will be displayed by BCB IDE itself...
 If it is displayed and in release mode on both the exe and the dll then In My Hamble Oppinion there must be used another approach and catch the exception inside the dll itself...
 I'm not real fun of your suggestion Greybird ( allthough its right ) because maybe we loose an exception handler we had to implement in our code...
 And you know that it is REALLY easy for that to happen... Anyway I'm coding with BCB from Version 1 and never unchecked those options... And I think it helped me...

These options are just Debugging options.

They do nothing more than catching the exception before your code can. In Debug mode, if you uncheck these options, C++ Builder will not catch the exception anymore, and you catch will handle it. Of course, even if C++ Builder intercept it, you have the option to tell it to continue executing the code, and then your catch block will run.

There is nothing wrong in disabling these options, for a simplier debugging of exception handling in your code. Of course it is better to have them checkes the rest of the time...

Why do you say : "maybe we loose an exception handler we had to implement in our code" ? I do not understand it very well...
George TokasCommented:
I had some bad experiances a few years before when an exception is raised at runtime...
Of course i didn't uncheck those options and still (because it was about 20000 line code) been a hell to find where that exception was raised...
The problem was not the exception but one function didn't executed after that...
I mean the exception in general is catched BUT NOT proccessed as needed so a function didn't executed...
After that "hell" I started to use try/catch/_finaly just to be sure...

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
Editors IDEs

From novice to tech pro — start learning today.