Skip to content

MultiModalLiveClient does not always report errors properly #81

@ladenedge

Description

@ladenedge

MultiModalLiveClient does a fair amount of custom logic on disconnect:

_client.DisconnectionHappened.Subscribe(info =>
{
if (info.Type == DisconnectionType.Error)
{
_logger?.LogConnectionClosedWithError(info.Type, info.Exception!);
ErrorOccurred?.Invoke(this, new ErrorEventArgs(info.Exception!));
}
else if (info.CloseStatus == WebSocketCloseStatus.InvalidPayloadData)
{
//log info.CloseStatusDescription
_logger?.LogConnectionClosedWithInvalidPyload(info.CloseStatusDescription!);
}
else if (info.CloseStatus == WebSocketCloseStatus.InternalServerError && !string.IsNullOrEmpty(info.CloseStatusDescription))
{
_logger?.LogConnectionClosedWithError(info.Type, info.Exception!);
Disconnected?.Invoke(this, new ErrorMessageEventArgs(info.CloseStatusDescription));
}
else
{
_logger?.LogConnectionClosed();
Disconnected?.Invoke(this, EventArgs.Empty);
}

But if a case arises that isn't handled by its custom logic, it's surprisingly difficult to get at the underlying error. The use case in question was:

  • info.Type = ByServer
  • info.CloseStatus = PolicyViolation

The info.CloseStatusDescription did contain the proper error message, but that error message is lost in the current logic and there was no clear way to adjust the DisconnectionHappened event before the Start() provoked the error. (See also #79.)

Anyway, long story short I think this handler could be a little more permissive in what it allows back to the user.

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