Skip to content

Commit

Permalink
catch errors while getting args in capture tree
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx authored Oct 12, 2023
1 parent be8a7d4 commit 884312d
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions ember_debug/libs/render-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,30 @@ class InElementSupportProvider {

const captureNode = this.debugRenderTree.captureNode;
this.debugRenderTree.captureNode = function (...args) {
const capture = captureNode.call(this, ...args);
const nodeFor = this.nodeFor;
const [id, state] = args;
const node = this.nodeFor(state);
self.setupNodeRemotes(node, id, capture);
let capture;
try {
capture = captureNode.call(this, ...args);
self.setupNodeRemotes(node, id, capture);
} catch (e) {
this.nodeFor = () => {
this.nodeFor = nodeFor;
return {
...node,
args: {
named: {},
positional: [],
},
};
};
capture = captureNode.call(this, ...args);
capture.args = { named: { e }, positional: [] };
self.setupNodeRemotes(node, id, capture);
} finally {
this.nodeFor = nodeFor;
}
return capture;
};

Expand Down

0 comments on commit 884312d

Please sign in to comment.