Skip to content

Where the Node console gets confused if constructor is an accessor #636

@erights

Description

@erights

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?

Metadata

Metadata

Assignees

Labels

debugging supportecosystem-compatibilityTracks a compatibility issue in a third-party package or packages.kriskowal-review-2024-01Issues that kriskowal wants to bring to the attention of the team for review as of January, 2024

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions