Skip to content
This repository was archived by the owner on Jul 28, 2020. It is now read-only.
This repository was archived by the owner on Jul 28, 2020. It is now read-only.

Throw InvalidOperationException in TcpClientSession.Connect() instead of Exception() #99

@jamesmcguirepro

Description

@jamesmcguirepro

When connect() is called on a TcpClientSession that is already connected or in process of being connected, an InvalidOperationException should be thrown, not a generic Exception.

throw new Exception("The socket is connecting, cannot connect again!");

throw new Exception("The socket is connected, you needn't connect again!");

This mimics System.Net.Socket.ConnectAsync()'s exceptions:
https://docs.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.connectasync?view=netframework-4.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions