Bug 912699 - improve load source error messages; r=past
authorNick Fitzgerald <fitzgen@gmail.com>
Thu, 05 Sep 2013 09:43:09 -0700
changeset 158611 a72b2b8b82dfef753dc9e507107478b721826327
parent 158610 fb3a60e0fedad0376c3116c209b2fde91b141aec
child 158612 668d5c3eec49a533182661719ed61bb50ea23851
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast
bugs912699
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 912699 - improve load source error messages; r=past
browser/devtools/debugger/debugger-controller.js
toolkit/devtools/server/actors/script.js
--- a/browser/devtools/debugger/debugger-controller.js
+++ b/browser/devtools/debugger/debugger-controller.js
@@ -1117,17 +1117,17 @@ SourceScripts.prototype = {
     }
 
     // Get the source text from the active thread.
     this.activeThread.source(aSource).source((aResponse) => {
       if (aOnTimeout) {
         window.clearTimeout(fetchTimeout);
       }
       if (aResponse.error) {
-        deferred.reject([aSource, aResponse.message]);
+        deferred.reject([aSource, aResponse.message || aResponse.error]);
       } else {
         deferred.resolve([aSource, aResponse.source]);
       }
     });
 
     return deferred.promise;
   },
 
--- a/toolkit/devtools/server/actors/script.js
+++ b/toolkit/devtools/server/actors/script.js
@@ -3726,27 +3726,30 @@ function fetch(aURL, aOptions={ loadFrom
 
   switch (scheme) {
     case "file":
     case "chrome":
     case "resource":
       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;
           }
 
           let source = NetUtil.readInputStreamToString(aStream, aStream.available());
           contentType = aRequest.contentType;
           deferred.resolve(source);
           aStream.close();
         });
       } catch (ex) {
-        deferred.reject(new Error("Request failed: " + url));
+        deferred.reject(ex);
       }
       break;
 
     default:
       let channel;
       try {
         channel = Services.io.newChannel(url, null, null);
       } catch (e if e.name == "NS_ERROR_UNKNOWN_PROTOCOL") {
@@ -3754,25 +3757,31 @@ function fetch(aURL, aOptions={ loadFrom
         // newChannel won't be able to handle it.
         url = "file:///" + url;
         channel = Services.io.newChannel(url, null, null);
       }
       let chunks = [];
       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) {
           chunks.push(NetUtil.readInputStreamToString(aStream, aCount));
         },
         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;
           }
 
           charset = channel.contentCharset;
           contentType = channel.contentType;
           deferred.resolve(chunks.join(""));
         }
       };