[Pkg-javascript-commits] [dojo] 120/149: fixes #18769, fixes #16223, return more useful error message when non 2XX response with json

David Prévot taffit at moszumanska.debian.org
Sat Feb 27 03:13:54 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository dojo.

commit 15175cb3d5afc19892304e6ee1cd196d008ce234
Author: Dylan Schiemann <dylan at dojotoolkit.org>
Date:   Wed Dec 30 13:38:56 2015 -0700

    fixes #18769, fixes #16223, return more useful error message when non 2XX response with json
---
 request/xhr.js | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/request/xhr.js b/request/xhr.js
index d857d76..d4ad92c 100644
--- a/request/xhr.js
+++ b/request/xhr.js
@@ -71,15 +71,31 @@ define([
 				error = e;
 			}
 		}
-
+		var handleError;
 		if(error){
 			this.reject(error);
-		}else if(util.checkStatus(_xhr.status)){
-			this.resolve(response);
 		}else{
-			error = new RequestError('Unable to load ' + response.url + ' status: ' + _xhr.status, response);
-
-			this.reject(error);
+			try{
+				handlers(response);
+			}catch(e){
+				handleError = e;
+			}
+			if(util.checkStatus(_xhr.status)){
+				if(!handleError){
+					this.resolve(response);
+				}else{
+					this.reject(handleError);
+				}
+			}else{
+				if(!handleError){
+					error = new RequestError('Unable to load ' + response.url + ' status: ' + _xhr.status, response);
+					this.reject(error);
+				}else{
+					error = new RequestError('Unable to load ' + response.url + ' status: ' + _xhr.status +
+						' and an error in handleAs: transformation of response', response);
+    				this.reject(error);
+				}
+			}
 		}
 	}
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git



More information about the Pkg-javascript-commits mailing list