From 5184b117a483865b12b996d10be9bcbf551f5f2e Mon Sep 17 00:00:00 2001
From: Prakash M <prakash@qualiantech.com>
Date: Fri, 15 Apr 2022 17:05:59 +0530
Subject: [PATCH] Fixed BUG-48875: Added TimeOut TerminalLog for following
 Requests * OB.DS.Process * OB.DS.Request * OB.RR.Request *
 OB.Data.ExtensibleModel

---
 .../source/data/ob-datasource.js                   | 14 ++++++++++++++
 .../source/data/ob-requestrouter.js                |  7 +++++++
 2 files changed, 21 insertions(+)

diff --git a/web/org.openbravo.mobile.core/source/data/ob-datasource.js b/web/org.openbravo.mobile.core/source/data/ob-datasource.js
index 62192105..504b770f 100644
--- a/web/org.openbravo.mobile.core/source/data/ob-datasource.js
+++ b/web/org.openbravo.mobile.core/source/data/ob-datasource.js
@@ -244,6 +244,13 @@
         if (inSender && inSender === 'timeout') {
           inResponse.timeout = true;
         }
+        if (inResponse.timeout) {
+          OB.error(
+            `Request to ${source} timed out after ${this.timeout} milliseconds`
+          );
+        } else {
+          OB.error(`Request to ${source} responded with error`);
+        }
         serviceError(inSender, inResponse, callback, callbackError);
       }
     });
@@ -331,6 +338,13 @@
             );
           }
         });
+        if (inSender && inSender === 'timeout') {
+          OB.error(
+            `Request to ${source} timed out after ${this.timeout} milliseconds`
+          );
+        } else {
+          OB.error(`Request to ${source} responded with error`);
+        }
         serviceError(inSender, inResponse, callback, callbackError);
       }
     });
diff --git a/web/org.openbravo.mobile.core/source/data/ob-requestrouter.js b/web/org.openbravo.mobile.core/source/data/ob-requestrouter.js
index 48b75003..cba9f885 100644
--- a/web/org.openbravo.mobile.core/source/data/ob-requestrouter.js
+++ b/web/org.openbravo.mobile.core/source/data/ob-requestrouter.js
@@ -70,6 +70,13 @@
           ajaxRequest.origFail = ajaxRequest.fail;
         }
         ajaxRequest.fail = function(inSender, inResponse) {
+          if (inSender && inSender === 'timeout') {
+            OB.error(
+              `Request to ${this.url} timed out after ${this.timeout} milliseconds`
+            );
+          } else {
+            OB.error(`Request to ${this.url} responded with error`);
+          }
           // found a special behavior:
           // if a request fails right away then fail is called. Then after the timeout
           // again fail is called.
-- 
2.20.1

