mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 09:54:30 +01:00
Do not spam logs if we can't connect to lightning because lightning is not started
This commit is contained in:
parent
be90172840
commit
2a302ea346
@ -100,13 +100,25 @@ namespace BTCPayServer.Payments.Lightning
|
||||
{
|
||||
var charge = lightningSupportedMethod.CreateClient(network);
|
||||
LightningInvoice chargeInvoice = null;
|
||||
string errorMessage = $"{lightningSupportedMethod.CryptoCode} (Lightning): Can't connect to the lightning server";
|
||||
try
|
||||
{
|
||||
chargeInvoice = await charge.GetInvoice(lightningMethod.InvoiceId);
|
||||
}
|
||||
catch (System.Net.Sockets.SocketException socketEx) when (socketEx.SocketErrorCode == System.Net.Sockets.SocketError.ConnectionRefused)
|
||||
{
|
||||
Logs.PayServer.LogError(errorMessage);
|
||||
continue;
|
||||
}
|
||||
catch (Exception ex) when (ex.InnerException is System.Net.Sockets.SocketException socketEx
|
||||
&& socketEx.SocketErrorCode == System.Net.Sockets.SocketError.ConnectionRefused)
|
||||
{
|
||||
Logs.PayServer.LogError(errorMessage);
|
||||
continue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logs.PayServer.LogError(ex, $"{lightningSupportedMethod.CryptoCode} (Lightning): Can't connect to the lightning server");
|
||||
Logs.PayServer.LogError(ex, errorMessage);
|
||||
continue;
|
||||
}
|
||||
if (chargeInvoice == null)
|
||||
|
Loading…
Reference in New Issue
Block a user