Hi,
In my code I have the following routine:
class function TService.PerformServiceGetRequest(const ServicePath:String):TJSXMLHttpRequest;
var
wr:TWebHttpRequest;
begin
try
try
wr := TWebHttpRequest.Create(nil);
wr.Command := thttpcommand.httpGET;
wr.URL := Format('%s/%s',
[TDatabase.GetServerAddress, ServicePath]
);
wr.Headers.Clear;
wr.Headers.AddPair('content-type', 'application/json');
wr.User:=TDatabase.GetUser;
wr.Password:=TDatabase.GetPassword;
Result:=(await(TJSXMLHttpRequest, wr.Perform));
except
on E:Exception do
Result:=nil
end;
finally
wr.Free;
end;
end;
I have encountered a point in my program where an error occurs.
Having walked through with the debugger, it gets to THttpRequest.HandleError, and an exception is raised.
Now, the reason for why the error occurs is on my end; however, what I don't understand is why the exception is not caught, as I have a try-catch around the web request as seen in the above.
Am I doing error handling incorrectly or is this a bug?
Thanks!