summaryrefslogtreecommitdiff
path: root/ext/console/01_console.js
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2023-09-19 12:24:19 -0600
committerGitHub <noreply@github.com>2023-09-19 18:24:19 +0000
commit612818d04399ef706df3df5ac94e6ef7e633cff7 (patch)
tree14d5f4313efe9fdc69a4ee3f7b0f5e72f62f7747 /ext/console/01_console.js
parent40122d7f2a867660900612980dfc75eece0d5e29 (diff)
fix(cli): ensure that an exception in getOwnPropertyDescriptor('constructor') doesn't break Deno.inspect (#20568)
Fixes #20561
Diffstat (limited to 'ext/console/01_console.js')
-rw-r--r--ext/console/01_console.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/console/01_console.js b/ext/console/01_console.js
index 8d9c56c92..a766bb641 100644
--- a/ext/console/01_console.js
+++ b/ext/console/01_console.js
@@ -1202,7 +1202,12 @@ function getConstructorName(obj, ctx, recurseTimes, protoProps) {
let firstProto;
const tmp = obj;
while (obj || isUndetectableObject(obj)) {
- const descriptor = ObjectGetOwnPropertyDescriptor(obj, "constructor");
+ let descriptor;
+ try {
+ descriptor = ObjectGetOwnPropertyDescriptor(obj, "constructor");
+ } catch {
+ /* this could fail */
+ }
if (
descriptor !== undefined &&
typeof descriptor.value === "function" &&