Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TidHTTP Class Error Trapping

Status
Not open for further replies.

ahhchu

Programmer
Sep 19, 2001
38
US
I am using the HTTP class to communicate to a web server. I use the following code and it works fine, except it the servername or port is incorrect it pops up a dialog box. I need to trap the error programmatically. Any suggestions?

Thanks

function TForm1.HttpGetInfo : Integer;
var
sErrVal : string;
iPos : byte;
strErr : string;
begin
try
strURLRtn := Http1.Get(strURL);
//Http1 declared elsewhere as Http1 : TiDHTTP;
except
on E:Exception do
begin
sErrMsg := E.Message;
strErr := E.Message;
strErr := Trim(strErr);
iPos := Pos(' ',strErr);
sErrVal := Copy(strErr,1,iPos-1);
Result := StrToInt(sErrVal);
//HandleError(E.Message, E.HelpContext);
Exit;
end;
end;
Result := 0;
end;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top