fix(console): handle error when inspecting promise-like (#19083)

Fixes
1105900195.

This was caused by: 
- A `TypeError` from `core.getPromiseDetails()` for promise-likes which
also lead to that code path.
- Swallowing internal formatting errors by returning `undefined`. I've
made it so that a special message is formatted in that case instead
(note that this case is fixed now):
![image](65bb9612-60b2-4e31-bf5e-e20976601593)
This commit is contained in:
Nayeem Rahman 2023-05-11 14:08:17 +01:00 committed by GitHub
parent 2ba9ccc1ab
commit ffb0318e4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 29 deletions

View file

@ -2235,6 +2235,13 @@ Deno.test(function inspectWithPrototypePollution() {
}
});
Deno.test(function inspectPromiseLike() {
assertEquals(
Deno.inspect(Object.create(Promise.prototype)),
"Promise { <unknown> }",
);
});
Deno.test(function inspectorMethods() {
console.timeStamp("test");
console.profile("test");