I am using a domain with an untrusted TLS (SSL) certificate so I could debug something.
This is my code:
procedure test();
var
WinHttpReq: Variant;
begin
WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
try
WinHttpReq.Open('POST', 'https://tv.eurosport.com/', False);
WinHttpReq.SetRequestHeader('Content-Type', 'application/json');
WinHttpReq.Send('');
except
MsgBox(IntToStr(WinHttpReq.Status), mbError, MB_OK);
end;
end;
In case there was an error with the request I would like to print the HTTP status code.
The problem is that the line in the except
clause is never executed and instead I get the following error:
Even if I run the executable without debugger attached it still causes errors.
How do I handle an OleObject
exception in Inno Setup?