Skip to content

skipFiles does not suppress "uncaught" exceptions in web streams #53789

Open
@rotu

Description

Version

22.4.1

Platform

Microsoft Windows NT 10.0.22635.0 x64

Subsystem

No response

What steps will reproduce the bug?

Run this code in the VSCode debugger with "skipFiles":["<node_internals>/**"] in the launch configuration.

import net from 'node:net';
import stream from 'node:stream';
const socket = net.connect('http://host.invalid.');
socket.on('error', (e) => {
   console.error('Caught the error', e.message);
});
let myStream = stream.Duplex.toWeb(socket);

setTimeout(() => {
   console.log('done');
}, 1000);

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior? Why is that the expected behavior?

It is expected that the debugger won't trip. This promise rejection is entirely created and handled within node's internals and should be suppressed by the VSCode's skipFiles filter.

What do you see instead?

The debugger breaks when the promise is rejected.

The trace (given by console.trace) when it is rejected looks like:

Trace
    at eval (eval-7c2224bb.repl:1:9)
    at Object.reject (<anonymous>)
    at writableStreamRejectCloseAndClosedPromiseIfNeeded (node:internal/webstreams/writablestream:771:28)
    at writableStreamFinishErroring (node:internal/webstreams/writablestream:903:5)
    at writableStreamStartErroring (node:internal/webstreams/writablestream:755:5)
    at writableStreamDefaultControllerError (node:internal/webstreams/writablestream:1202:3)
    at WritableStreamDefaultController.error (node:internal/webstreams/writablestream:502:5)
    at Socket.<anonymous> (node:internal/webstreams/adapters:195:18)
    at Socket.<anonymous> (node:internal/util:538:20)
    at Socket.onclose (node:internal/streams/end-of-stream:152:25)

The stack on the error object is:

'AbortError: The operation was aborted
    at handleKnownInternalErrors (node:internal/webstreams/adapters:111:14)
    at Socket.<anonymous> (node:internal/webstreams/adapters:179:13)
    at Socket.<anonymous> (node:internal/util:538:20)
    at Socket.onclose (node:internal/streams/end-of-stream:152:25)
    at Socket.emit (node:events:532:35)
    at Pipe.<anonymous> (node:net:339:12)
    at Pipe.callbackTrampoline (node:internal/async_hooks:130:17)'

Screenshot 2024-07-09 133433

Additional information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    debuggerIssues and PRs related to the debugger subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions