# HG changeset patch
# User Javier Armendáriz <javier.armendariz@openbravo.com>
# Date 1515158400 -3600
#      Fri Jan 05 14:20:00 2018 +0100
# Node ID 858d3384985d28af7a534947a2086ec67d2be7ef
# Parent  5277301a598c409c1589bbeef25ac640b9c8f435
Related with bug 35268: No message displayed on request timeout responses.

The RPC response handler does not show any message when the request fails. Now it shows an error in the messageBar if its a server timeout.

diff --git a/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
--- a/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
+++ b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2011-2017 Openbravo SLU
+ * All portions are Copyright (C) 2011-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -774,11 +774,24 @@
       delete target.view.isRefreshing;
       target.view.toolBar.updateButtonState();
     }
+
+    if (this.isServerTimeoutResponse(response) && this.canShowErrorMessage(target)) {
+      target.view.setErrorMessageFromResponse(response, response.data, request);
+    }
+
     if (!request.willHandleError) {
       this._originalhandleError(response, request);
     }
   },
 
+  isServerTimeoutResponse: function (response) {
+    return response.status === isc.RPCResponse.STATUS_SERVER_TIMEOUT;
+  },
+
+  canShowErrorMessage: function (target) {
+    return target && target.view && isc.isA.Function(target.view.setErrorMessageFromResponse);
+  },
+
   _originalEvalResult: isc.RPCManager.evalResult,
   evalResult: function (request, response, results) {
     // if the response contains an error status, call the errorCallback
