mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-08 00:16:27 +00:00
Added catching of exception in message handler
This commit is contained in:
parent
1b6e1f99f8
commit
16af1b48bc
@ -138,10 +138,17 @@ namespace CryptoExchange.Net
|
|||||||
protected virtual void ProcessMessage(SocketSubscription subscription, string data)
|
protected virtual void ProcessMessage(SocketSubscription subscription, string data)
|
||||||
{
|
{
|
||||||
log.Write(LogVerbosity.Debug, $"Socket {subscription.Socket.Id} received data: " + data);
|
log.Write(LogVerbosity.Debug, $"Socket {subscription.Socket.Id} received data: " + data);
|
||||||
|
try
|
||||||
|
{
|
||||||
foreach (var handler in subscription.MessageHandlers)
|
foreach (var handler in subscription.MessageHandlers)
|
||||||
if (handler.Value(subscription, JToken.Parse(data)))
|
if (handler.Value(subscription, JToken.Parse(data)))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
log.Write(LogVerbosity.Error, $"Exception during message processing: " + ex.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handler for a socket closing. Reconnects the socket if needed, or removes it from the active socket list if not
|
/// Handler for a socket closing. Reconnects the socket if needed, or removes it from the active socket list if not
|
||||||
|
Loading…
x
Reference in New Issue
Block a user