Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TIdHTTP error details
#5
(08-16-2022, 07:30 PM)rlebeau Wrote: By default, the EIdHTTPProtocolException::ErrorMessage property contains the body content of the HTTP response.  Alternatively, if you want to receive the error body content in your TMemoryStream, you can enable the hoNoProtocolErrorException and hoWantProtocolErrorContent flags in the TIdHTTP::HTTPOptions property....Just FYI, you should be using System::String instead of AnsiString, and more importantly you are leaking the TMemoryStream if TIdHTTP::Get() or TMemoryStream::SaveToFile() throws an exception.  You should protect the TMemoryStream with a try/__finally block, or a RAII wrapper like std::auto_ptr or std::unique_ptr (depending on which compiler you are using).


Thank you, Remy.
Thank you, Remy.
Thank you, Remy.
Reply


Messages In This Thread
TIdHTTP error details - by Boba TC - 08-16-2022, 01:23 AM
RE: TIdHTTP error details - by fearcry - 08-16-2022, 01:27 PM
RE: TIdHTTP error details - by rlebeau - 08-16-2022, 07:30 PM
RE: TIdHTTP error details - by Boba TC - 08-20-2022, 04:06 AM
RE: TIdHTTP error details - by Boba TC - 08-20-2022, 11:27 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)