?
Solved

PowerSock Exception Handling

Posted on 2003-03-09
1
Medium Priority
?
578 Views
Last Modified: 2007-12-19
Hi.  I'm trying to use the TPowersock component or the NMHTTP component.  My problem arises when I try to conenct to a host and the connection fails.  The ConnectionFailed function is called, I do what I want, but then my program crashes and Delphi gives me a message box saying "raised exception class ESockError with message: 'Conenction Failed'".  How do I correctly handle the ConnectionFailed event ( and deal with the exception ) so that it won't give the messagebox and crash my program?

Thanks in advance.
0
Comment
Question by:wizardtim
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
Svisj earned 80 total points
ID: 8127521
hi!
Maybe this will help you

bogustarget := false;
try
NMHttp1.Get(Edit1.Text);
 except
on E: ESockError do bogustarget := true;
on E: EInvalidOperation do bogustarget := true;
//etc...
end;

You will know that "if bogustarget = true" then the Nmhttp.Component didn't do anything but raise exceptions!

In debug mode it is possible to turn off "exception notifications", but I don't know how to do that exactly. But it is not nessecary because when you compile the file and run the EXE file (not from Delphi), the messages you have trapped should not show.

In debug mode just press Enter and F9 to accept the notification, if you have handled it correctly it should not CRASH your app 8=) Hope this helps!  
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question