TFPHTTPClient and Exception lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- phlr_fr · 2019-01-01 08:03 Good morning and Happy New year for everybody, I have some problems with the use of TFPHTTPClient that is why I decided to test it in a test project. The code in my test project don't do no more than this : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   try     vlHttpClient := TFPHTTPClient.Create(nil);     vlString     := vlHttp Client.post('http://localhost/testImp/index.php?p0=1&p1=b&p2=c&p3=d');    vlStatusCode := vlHttpClient.ResponseStatusCode;  except           showmessage('Coucou 1');  end;  vlHttpClient.Free; I want to test : 1) the site and the page are OK 2) the site exists but the page isn't ok 3) the site doesn't exist 4) there is no internet 1)    vlStatusCode=200, no message, good response    => OK 2) I modify line 3 like this Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i         vlString     := vlHttpClient.post('http://localhost/testImp/blablabla. php?p0=1&p1=b&p2=c&p3=d');   => vlStatusCode=404, no message    => OK 3) I modify line 3 like this Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     vlString     := vlHttpClient.post('http://blablabla/testImp/index.php? p0=1&p1=b&p2=c&p3=d');   =>   Window 'Debug error notification' : host name resolution for 'blablabla' failed       Clic on button 'Continue' => 'Coucouc 1' appears 4) I modify line 3 like this Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     vlString     := vlHttpClient.post('http://localhost/testImp/index.php? p0=1&p1=b&p2=c&p3=d');   but I stop the webserver and no Wifi    =>   Window 'Debug error notification' : Connect to localhost:80 failed       Clic on button 'Continue' => 'Coucouc 1' appears I don't understand why the try doesn't catch this exception in case 3 and 4, and how to do to catch it and avoid this exception's window. Thanks for advance for your responses. Philippe Win 7 Lazarus V 1.8.4 Laragon as test webserver ---------------------------------------------------------------------- Leledumbo · 2019-01-01 15:26 EVERY exception will be caught by the debugger BEFORE your except block. Open the attached dialog and add the exception name to the list or simply press continue.