Removed redundant casts in MessageQueue and improved error logging
This commit is contained in:
@@ -103,7 +103,7 @@ namespace Discord.Net
|
|||||||
}
|
}
|
||||||
private Task RunSendQueue(CancellationToken cancelToken)
|
private Task RunSendQueue(CancellationToken cancelToken)
|
||||||
{
|
{
|
||||||
return Task.Run((Func<Task>)(async () =>
|
return Task.Run(async () =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -134,7 +134,7 @@ namespace Discord.Net
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
msg.State = MessageState.Failed;
|
msg.State = MessageState.Failed;
|
||||||
_logger.Error("Failed to send message", ex);
|
_logger.Error($"Failed to send message to {msg.Channel.Path}", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -142,11 +142,11 @@ namespace Discord.Net
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (OperationCanceledException) { }
|
catch (OperationCanceledException) { }
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
private Task RunEditQueue(CancellationToken cancelToken)
|
private Task RunEditQueue(CancellationToken cancelToken)
|
||||||
{
|
{
|
||||||
return Task.Run((Func<Task>)(async () =>
|
return Task.Run(async () =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -168,7 +168,7 @@ namespace Discord.Net
|
|||||||
};
|
};
|
||||||
await _rest.Send(request).ConfigureAwait(false);
|
await _rest.Send(request).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (Exception ex) { _logger.Error("Failed to edit message", ex); }
|
catch (Exception ex) { _logger.Error($"Failed to edit message {edit.Message.Path}", ex); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,11 +176,11 @@ namespace Discord.Net
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (OperationCanceledException) { }
|
catch (OperationCanceledException) { }
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
private Task RunDeleteQueue(CancellationToken cancelToken)
|
private Task RunDeleteQueue(CancellationToken cancelToken)
|
||||||
{
|
{
|
||||||
return Task.Run((Func<Task>)(async () =>
|
return Task.Run(async () =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -200,7 +200,7 @@ namespace Discord.Net
|
|||||||
await _rest.Send(request).ConfigureAwait(false);
|
await _rest.Send(request).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (HttpException ex) when (ex.StatusCode == HttpStatusCode.NotFound) { } //Ignore
|
catch (HttpException ex) when (ex.StatusCode == HttpStatusCode.NotFound) { } //Ignore
|
||||||
catch (Exception ex) { _logger.Error("Failed to delete message", ex); }
|
catch (Exception ex) { _logger.Error($"Failed to delete message {msg.Path}", ex); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,7 +209,7 @@ namespace Discord.Net
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (OperationCanceledException) { }
|
catch (OperationCanceledException) { }
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void IncrementCount()
|
private void IncrementCount()
|
||||||
|
|||||||
Reference in New Issue
Block a user