Re: [fpc-devel] Avoid exception if FPHTTPClient cannot connect to server?

2017-07-31 Thread Michael Van Canneyt
On Mon, 31 Jul 2017, Werner Pamler wrote: Agreed. This is the same situation as with string-to-number conversion: StrToFloat fires an exception if the string is not a valid float, but there's also a "TryStrToFloat" which by-passes the exception and just returns a false in case of an error.

Re: [fpc-devel] Avoid exception if FPHTTPClient cannot connect to server?

2017-07-31 Thread Werner Pamler
Agreed. This is the same situation as with string-to-number conversion: StrToFloat fires an exception if the string is not a valid float, but there's also a "TryStrToFloat" which by-passes the exception and just returns a false in case of an error. Why not having something like a "TryGet"

Re: [fpc-devel] Avoid exception if FPHTTPClient cannot connect to server?

2017-07-31 Thread Michael Van Canneyt
On Mon, 31 Jul 2017, Werner Pamler wrote: Here is a little demo program which uses fphttpclient to download some file from some server. If the URL exists everything is fine (note on Windows, that the OpenSSL dlls must be copied to the exe directory for the demo to work). If the URL does

Re: [fpc-devel] Avoid exception if FPHTTPClient cannot connect to server?

2017-07-31 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 31 Jul 2017, Werner Pamler wrote: > If the URL exists everything is fine (note on Windows, that the OpenSSL > dlls must be copied to the exe directory for the demo to work). If the > URL does not exist, but the server responds, the program returns the > well-known error 404 (if the