Bug 1525966 - Reject Error object instead of string in DevTools Front:onPacket draft
authorJulian Descottes <jdescottes@mozilla.com>
Wed, 04 Dec 2019 16:51:07 +0000
changeset 2516017 f2254279690202817fe48e0cbd285970e532c179
parent 2513214 3c08edf74d039af79f9daad8ff5b57ffb64fdab6
child 2516018 952020252e97a8b4ab07ebdeb92f80607613932f
push id460091
push userreviewbot
push dateWed, 04 Dec 2019 16:51:41 +0000
treeherdertry@3c45aea5d07b [default view] [failures only]
bugs1525966
milestone73.0a1
Bug 1525966 - Reject Error object instead of string in DevTools Front:onPacket Differential Diff: PHID-DIFF-daschhe6ol5vkhgdzi6m
devtools/shared/protocol/Front.js
--- a/devtools/shared/protocol/Front.js
+++ b/devtools/shared/protocol/Front.js
@@ -261,26 +261,25 @@ class Front extends Pool {
       console.error(err);
       throw err;
     }
 
     const { deferred, stack } = this._requests.shift();
     callFunctionWithAsyncStack(
       () => {
         if (packet.error) {
-          // "Protocol error" is here to avoid TBPL heuristics. See also
-          // https://dxr.mozilla.org/webtools-central/source/tbpl/php/inc/GeneralErrorFilter.php
           let message;
           if (packet.error && packet.message) {
             message =
               "Protocol error (" + packet.error + "): " + packet.message;
           } else {
             message = packet.error;
           }
-          deferred.reject(message);
+          const packetError = new Error(message);
+          deferred.reject(packetError);
         } else {
           deferred.resolve(packet);
         }
       },
       stack,
       "DevTools RDP"
     );
   }