EIdHTTPProtocolException

Giganews Newsgroups
Subject: EIdHTTPProtocolException
Posted by:  Vlad Gonchar (vgonch…@performancesoft.com)
Date: Tue, 7 Feb 2006

Sometimes in the following code POST operation raises
EIdHTTPProtocolException
with ErrorCode= -1 and  empty (with some garbage inside) ErrorMessage. Why?
Mostly it works OK. I noticed it happens when POST timeouts (so in this case
I should get EIdReadTimeout, but I am not?! ) .

        try
          aResponse := fHttpClient.Post( fUrl, aContentStream ); // make
http request
        except
          on EIdReadTimeout do begin
            HandleHttpTimeout( IMessage.GetHttpResponseRequired,
fHttpClient.ReadTimeout );
            EXIT;
          end;
          on e: EIdHTTPProtocolException do begin
            aExceptionMsg := e.ErrorMessage;
            aErrorCode := e.ErrorCode;
            ....
            EXIT;
          end;
        else
          aExceptionMsg := ExceptionToStr;
          ...
          EXIT;
        end;

Replies