Where the Node console gets confused if `constructor` is an accessor
Following in the vscode debugger, I found where the Node inspector gets confused if a constructor is an accessor rather than data property. In something/internal/util/inspect.js I see
const descriptor = ObjectGetOwnPropertyDescriptor(obj, 'constructor');
if (descriptor !== undefined &&
typeof descriptor.value === 'function' &&
descriptor.value.name !== '' &&
tmp instanceof descriptor.value) {
@bmeck @michaelfig @kumavis @kriskowal Where do I find the actual source for this, so I can file a PR to fix this to work with constructors than have been made accessors in order to work around the override mistake?
@kumavis this is why {errorTaming: 'unsafe', consoleTaming: 'unsafe'} causes the built-in node console to print those errors as {}. Try changing to {errorTaming: 'unsafe', consoleTaming: 'unsafe', overrideTaming: 'min'} and you'll see your stack traces. Try changing to
{
errorTaming: 'unsafe',
consoleTaming: 'unsafe',
overrideTaming: 'min',
stackFiltering: 'verbose',
}
and you'll see the full original stack traces.
Btw, I strongly recommend against {consoleTaming: 'unsafe'}. Is there a reason you want to turn that on?
See #944
See https://github.com/endojs/endo/issues/2908
The snippet above has grown into the code at
https://github.com/nodejs/node/blob/fc3f19ef932444e8de5d69fe3fb5033b2e0ec2e4/lib/internal/util/inspect.js#L627
If the prototypes whose constructors we make into accessors were added to wellKnownPrototypes, our problems my well disappear.