From b134b3667840483cb4de12d9c04a4c554174955c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20St=C3=B6ckel?= Date: Fri, 23 Mar 2012 12:45:13 +0000 Subject: [PATCH] fixed some issues with egw_data, improved egw_json exception handling --- phpgwapi/js/jsapi/egw_data.js | 7 ++++--- phpgwapi/js/jsapi/egw_json.js | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/phpgwapi/js/jsapi/egw_data.js b/phpgwapi/js/jsapi/egw_data.js index 01586319c5..d4d7cb7086 100644 --- a/phpgwapi/js/jsapi/egw_data.js +++ b/phpgwapi/js/jsapi/egw_data.js @@ -156,7 +156,8 @@ egw.extend("data", egw.MODULE_APP_LOCAL, function (_app, _wnd) { function(result) { parseServerResponse(result, _callback, _context); }, - this + this, + true ); request.sendRequest(); } @@ -299,7 +300,7 @@ egw.extend("data_storage", egw.MODULE_GLOBAL, function (_app, _wnd) { * data. */ dataHasUID: function (_uid) { - return typeof this.localStorage[_uid] !== "undefined"; + return typeof localStorage[_uid] !== "undefined"; }, /** @@ -310,7 +311,7 @@ egw.extend("data_storage", egw.MODULE_GLOBAL, function (_app, _wnd) { var result = []; - for (var key in this.localStorage) + for (var key in localStorage) { var parts = key.split("::"); if (parts[0] === _prefix) diff --git a/phpgwapi/js/jsapi/egw_json.js b/phpgwapi/js/jsapi/egw_json.js index e1bb5e3f43..7d2cd3a293 100644 --- a/phpgwapi/js/jsapi/egw_json.js +++ b/phpgwapi/js/jsapi/egw_json.js @@ -35,7 +35,7 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) { * Internal implementation of the JSON request object. */ function json_request(_menuaction, _parameters, _callback, _context, - _sender, _async, _egw) + _async, _sender, _egw) { // Copy the parameters this.url = _egw.ajaxUrl(_menuaction); @@ -115,7 +115,9 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) { ); } catch(e) { - this.egw.debug('error', 'Exception "', e ,'" while handling JSON response type "', res.type, '", plugin', plugin, 'response', res); + var msg = e.message ? e.message : e + ''; + var stack = e.stack ? "\n-- Stack trace --\n" + e.stack : "" + this.egw.debug('error', 'Exception "' + msg + '" while handling JSON response type "' + res.type + '", plugin', plugin, 'response', res, stack); } } }