Skip to content

Expose error status codes #1892

@pimterry

Description

@pimterry
  • I've searched for any related issues and avoided creating a duplicate issue.

Description

When ws throws errors due to received content, it associates a websocket status code with them, which specifies the status code that will be sent when closing the connection.

It attaches this to the error behind a symbol called kStatusCode (used here, defined here), keeping that status code as internal private state that can't be easily or reliably accessed by application code.

That is inconvenient, because in some cases this is useful information for applications too, e.g. to tracking metrics of websocket failure reasons, or to implement various advanced error handling scenarios that depend on type of protocol failure involved.

Would you be open to making this a non-symbol property, so it's available as a reliable part of the API for error handling?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions