Try .inspect first
@@ -196,6 +196,9 @@ export class Error extends Result {
}
export function inspect(v) {
+ try {
+ return v.inspect();
+ } catch (_) {}
let t = typeof v;
if (v === true) return "True";
if (v === false) return "False";
@@ -207,12 +210,8 @@ export function inspect(v) {
if (v instanceof Set) return `//js(Set(${[...v].map(inspect).join(", ")}))`;
if (v instanceof RegExp) return `//js(${v})`;
if (v instanceof Date) return `//js(Date("${v.toISOString()}"))`;
- try {
- return v.inspect();
- } catch (_) {
return inspectObject(v);
}
-}
function inspectObject(v) {
let [keys, get] = getters(v);
