Jump to content
markus_ja

REST OnError: Get message, when server has timeout

Recommended Posts

Hello,

 

when I try to invoke a rest server, and the server is down or not responding, how to I get the proper message?

 

I use the following code:

REST[FRootURL, aSourceURI].Call
    .OnPrepare(
      procedure(http: TW3HttpRequest)
      begin
        OnPrepareDefault(http);
      end)
    .OnDone(
      procedure(http: TW3HttpRequest)
      begin
        OnDoneDefault(http);
      end)
    .OnError(
      procedure(http: TW3HttpRequest)
      begin
        OnErrorDefault(http);
        if Assigned(aOnError) then
          aOnError(http.ResponseText);
      end)
    .Get;

.OnError is invoked, but the http.RespnseText is empty. I also investigated the http object, there is no proper message.

Share this post


Link to post
Share on other sites

I have a similar problem. It seems that browsers won't clearly tell you that the server is unavailable. I ended up putting a timeout on the XHRs and will get a timeout event. Sometimes it's comfortable to un-set the timeout (esp. if you use both download and upload event objects) but that does not work in IE.

 

HTH,

 

/Dany

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×