Bug 977931 - return an error object even when restResponse.headers is null. r=spenrose
authorMark Hammond <mhammond@skippinet.com.au>
Fri, 28 Feb 2014 13:24:49 +1100
changeset 171534 2bc564e6e33de2df53ae539af2934a82f769dbe8
parent 171533 2ef6df41692a58b6490fa8a36050e81373ac0a66
child 171535 a267ac44d50637926741a94cd1d713bfe3022b73
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersspenrose
bugs977931
milestone30.0a1
Bug 977931 - return an error object even when restResponse.headers is null. r=spenrose
services/common/hawkclient.js
--- a/services/common/hawkclient.js
+++ b/services/common/hawkclient.js
@@ -66,17 +66,17 @@ this.HawkClient.prototype = {
    */
   _constructError: function(restResponse, errorString) {
     let errorObj = {
       error: errorString,
       message: restResponse.statusText,
       code: restResponse.status,
       errno: restResponse.status
     };
-    let retryAfter = restResponse.headers["retry-after"];
+    let retryAfter = restResponse.headers && restResponse.headers["retry-after"];
     retryAfter = retryAfter ? parseInt(retryAfter) : retryAfter;
     if (retryAfter) {
       errorObj.retryAfter = retryAfter;
     }
     return errorObj;
   },
 
   /*