mirror of
https://github.com/denoland/deno.git
synced 2025-09-28 13:14:48 +00:00
fix: don't swallow customInspect exceptions (#9095)
This commit is contained in:
parent
979d71c883
commit
2d1208556a
2 changed files with 9 additions and 28 deletions
|
@ -190,11 +190,7 @@
|
|||
|
||||
function inspectFunction(value, _ctx) {
|
||||
if (customInspect in value && typeof value[customInspect] === "function") {
|
||||
try {
|
||||
return String(value[customInspect]());
|
||||
} catch {
|
||||
// pass
|
||||
}
|
||||
return String(value[customInspect]());
|
||||
}
|
||||
// Might be Function/AsyncFunction/GeneratorFunction/AsyncGeneratorFunction
|
||||
let cstrName = Object.getPrototypeOf(value)?.constructor?.name;
|
||||
|
@ -865,11 +861,7 @@
|
|||
inspectOptions,
|
||||
) {
|
||||
if (customInspect in value && typeof value[customInspect] === "function") {
|
||||
try {
|
||||
return String(value[customInspect]());
|
||||
} catch {
|
||||
// pass
|
||||
}
|
||||
return String(value[customInspect]());
|
||||
}
|
||||
// This non-unique symbol is used to support op_crates, ie.
|
||||
// in op_crates/web we don't want to depend on unique "Deno.customInspect"
|
||||
|
@ -880,11 +872,7 @@
|
|||
nonUniqueCustomInspect in value &&
|
||||
typeof value[nonUniqueCustomInspect] === "function"
|
||||
) {
|
||||
try {
|
||||
return String(value[nonUniqueCustomInspect]());
|
||||
} catch {
|
||||
// pass
|
||||
}
|
||||
return String(value[nonUniqueCustomInspect]());
|
||||
}
|
||||
if (value instanceof Error) {
|
||||
return String(value.stack);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue