Skip to content

Make it easier to debug unhandled error events #3270

Closed
@binarykitchen

Description

@binarykitchen

We all hard-working developer fear this infamous error:

events.js:141
      throw er; // Unhandled 'error' event
            ^
Error: This socket is closed.
    at Socket._writeGeneric (net.js:638:19)
    at Socket._write (net.js:692:8)
    at doWrite (_stream_writable.js:292:12)
    at writeOrBuffer (_stream_writable.js:278:5)
    at Socket.Writable.write (_stream_writable.js:207:11)
    at Socket.write (net.js:616:40)
    at Socket.ondata (_stream_readable.js:521:20)
    at emitOne (events.js:82:20)
    at Socket.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:146:16)
    at Socket.Readable.push (_stream_readable.js:110:10)
    at Pipe.onread (net.js:521:20)

They are a pain to investigate. Can we make it somehow easier to debug those?

For example unhandled error events coming from sockets could at least include a better error message saying what kind of socket it is. And what listeners are attached to it. That would help enormously.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions