Bug 912699 - improve load source error messages; r=past

This commit is contained in:
Nick Fitzgerald 2013-09-05 09:43:09 -07:00
parent 10aec2ea5b
commit b55c712644
2 changed files with 14 additions and 5 deletions

View File

@ -1122,7 +1122,7 @@ SourceScripts.prototype = {
window.clearTimeout(fetchTimeout);
}
if (aResponse.error) {
deferred.reject([aSource, aResponse.message]);
deferred.reject([aSource, aResponse.message || aResponse.error]);
} else {
deferred.resolve([aSource, aResponse.source]);
}

View File

@ -3731,7 +3731,10 @@ function fetch(aURL, aOptions={ loadFromCache: true }) {
try {
NetUtil.asyncFetch(url, function onFetch(aStream, aStatus, aRequest) {
if (!Components.isSuccessCode(aStatus)) {
deferred.reject(new Error("Request failed: " + url));
deferred.reject(new Error("Request failed with status code = "
+ aStatus
+ " after NetUtil.asyncFetch for url = "
+ url));
return;
}
@ -3741,7 +3744,7 @@ function fetch(aURL, aOptions={ loadFromCache: true }) {
aStream.close();
});
} catch (ex) {
deferred.reject(new Error("Request failed: " + url));
deferred.reject(ex);
}
break;
@ -3759,7 +3762,10 @@ function fetch(aURL, aOptions={ loadFromCache: true }) {
let streamListener = {
onStartRequest: function(aRequest, aContext, aStatusCode) {
if (!Components.isSuccessCode(aStatusCode)) {
deferred.reject(new Error("Request failed: " + url));
deferred.reject(new Error("Request failed with status code = "
+ aStatusCode
+ " in onStartRequest handler for url = "
+ url));
}
},
onDataAvailable: function(aRequest, aContext, aStream, aOffset, aCount) {
@ -3767,7 +3773,10 @@ function fetch(aURL, aOptions={ loadFromCache: true }) {
},
onStopRequest: function(aRequest, aContext, aStatusCode) {
if (!Components.isSuccessCode(aStatusCode)) {
deferred.reject(new Error("Request failed: " + url));
deferred.reject(new Error("Request failed with status code = "
+ aStatusCode
+ " in onStopRequest handler for url = "
+ url));
return;
}