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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...