debugger icon indicating copy to clipboard operation
debugger copied to clipboard

[Expressions] Format “ReferenceErrors"

Open jasonLaster opened this issue 9 years ago • 2 comments

We currently show the full error in the watch expressions pane. It would be nice to replace this with something like "not available"

Patch


diff --git a/src/components/SecondaryPanes/Expressions.js b/src/components/SecondaryPanes/Expressions.js
index 861e8b5..5207ee1 100644
--- a/src/components/SecondaryPanes/Expressions.js
+++ b/src/components/SecondaryPanes/Expressions.js
@@ -145,6 +145,9 @@ class Expressions extends React.Component {

     const { value, path } = getValue(expression);

+    // we can detect the ReferenceError here and do something where we replace the
+    // value with the string "(unavailable)" or an object { unavailable: true }
+
     const root = {
       name: expression.input,
       path,
diff --git a/src/components/shared/ObjectInspector.js b/src/components/shared/ObjectInspector.js
index 537cfab..0149160 100644
--- a/src/components/shared/ObjectInspector.js
+++ b/src/components/shared/ObjectInspector.js
@@ -138,7 +138,7 @@ class ObjectInspector extends Component {
     let label = item.name;
     if (nodeIsOptimizedOut(item)) {
       objectValue = dom.span({ className: "unavailable" }, "(optimized away)");
-    } else if (nodeIsMissingArguments(item)) {
+    } else if (nodeIsMissingArguments(item) || item.unavailable) {
       objectValue = dom.span({ className: "unavailable" }, "(unavailable)");
     } else if (nodeIsFunction(item)) {
       objectValue = null;

jasonLaster avatar Apr 20 '17 18:04 jasonLaster

May I work on this?

sharathnarayanph avatar May 05 '17 15:05 sharathnarayanph

@sharathnarayanph go for it! ask us questions in slack if this is complicated

jasonLaster avatar May 05 '17 15:05 jasonLaster