[gjs/mozjs91: 132/135] Add TypeError to Error debugger printer




commit 955f1047ca58c8f76000f8afab12513fee2afcee
Author: Evan Welsh <contact evanwelsh com>
Date:   Sat Jul 10 21:07:08 2021 -0700

    Add TypeError to Error debugger printer
    
    dv.class is no longer Error for subclasses of Error,
    without this change the debugger will print {} instead
    of [object TypeError]

 installed-tests/debugger/backtrace.debugger.output | 2 +-
 modules/script/_bootstrap/debugger.js              | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/installed-tests/debugger/backtrace.debugger.output 
b/installed-tests/debugger/backtrace.debugger.output
index a74e0b06..2f2bb4c9 100644
--- a/installed-tests/debugger/backtrace.debugger.output
+++ b/installed-tests/debugger/backtrace.debugger.output
@@ -31,7 +31,7 @@ Unwinding due to exception. (Type 'c' to continue unwinding.)
 #0    mistake([object Array]) at backtrace.debugger.js:14:33
    14      let {uninitialized_} = array.shift();
 Exception value is:
-$1 = [object Error]
+$1 = [object TypeError]
 TypeError: array.shift() is undefined
 db> bt full
 #0    mistake([object Array]) at backtrace.debugger.js:14:33
diff --git a/modules/script/_bootstrap/debugger.js b/modules/script/_bootstrap/debugger.js
index 6b5020fe..8c1fcec6 100644
--- a/modules/script/_bootstrap/debugger.js
+++ b/modules/script/_bootstrap/debugger.js
@@ -64,7 +64,7 @@ function debuggeeValueToString(dv, style = {pretty: options.pretty}) {
     if (!style.pretty || dv === null || typeof dv !== 'object')
         return [dvrepr, undefined];
 
-    if (['Error', 'GIRespositoryNamespace', 'GObject_Object'].includes(dv.class)) {
+    if (['TypeError', 'Error', 'GIRespositoryNamespace', 'GObject_Object'].includes(dv.class)) {
         const errval = debuggeeGlobalWrapper.executeInGlobalWithBindings(
             'v.toString()', {v: dv});
         return [dvrepr, errval['return']];


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]