From a409a82f7e8370e099299d915503cbcfa431286e Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Sun, 27 Apr 2014 12:29:26 +0530 Subject: [PATCH] catch 417 in request.js --- frappe/public/js/frappe/request.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frappe/public/js/frappe/request.js b/frappe/public/js/frappe/request.js index 8589b3f256..cdb792da90 100644 --- a/frappe/public/js/frappe/request.js +++ b/frappe/public/js/frappe/request.js @@ -50,15 +50,19 @@ frappe.request.call = function(opts) { type: 'POST', dataType: opts.dataType || 'json', statusCode: { + 200: function(data, xhr) { + if(typeof data === "string") data = JSON.parse(data); + opts.success && opts.success(data, xhr.responseText); + }, 404: function(xhr) { msgprint(__("Not found")); }, 403: function(xhr) { msgprint(__("Not permitted")); }, - 200: function(data, xhr) { + 417: function(data, xhr) { if(typeof data === "string") data = JSON.parse(data); - opts.success && opts.success(data, xhr.responseText); + opts.error && opts.error(data, xhr.responseText) }, 501: function(data, xhr) { if(typeof data === "string") data = JSON.parse(data);