Skip to content

Commit

Permalink
print error
Browse files Browse the repository at this point in the history
  • Loading branch information
juuwel committed May 28, 2024
1 parent 4fbad2d commit ebfac26
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Tests/WebSocketTestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ public WebSocketTestClient(string? url = null)
Client.MessageReceived.Subscribe(msg =>
{
BaseDto baseDto = JsonSerializer.Deserialize<BaseDto>(msg.Text);
Console.WriteLine("Received message: " + baseDto.eventType);

if (baseDto.eventType == "ServerSendsErrorMessage" || baseDto.eventType.Contains("ServerResponds") || baseDto.eventType.Contains("ServerRejects"))
if (baseDto.eventType == "ServerSendsErrorMessage" || baseDto.eventType.Contains("ServerResponds") ||
baseDto.eventType.Contains("ServerRejects"))
{
var error = JsonSerializer.Deserialize<ServerSendsErrorMessage>(msg.Text);
throw new Exception(error!.Error);
Console.WriteLine("Error: " + error!.Error);
}

lock (ReceivedMessages)
ReceivedMessages.Add(baseDto);
});
Expand Down

0 comments on commit ebfac26

Please sign in to comment.