Add exception for webhook + add gracefull time before market decrease
This commit is contained in:
@@ -22,11 +22,11 @@ public class WebhookService : IWebhookService
|
||||
_configuration = configuration;
|
||||
_logger = logger;
|
||||
_n8nWebhookUrl = _configuration["N8n:WebhookUrl"] ?? string.Empty;
|
||||
|
||||
|
||||
// Configure basic authentication if credentials are provided
|
||||
var username = _configuration["N8n:Username"];
|
||||
var password = _configuration["N8n:Password"];
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password))
|
||||
{
|
||||
var credentials = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{username}:{password}"));
|
||||
@@ -63,12 +63,12 @@ public class WebhookService : IWebhookService
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning($"Failed to send webhook notification. Status: {response.StatusCode}");
|
||||
throw new Exception($"Failed to send webhook message. Status: {response.StatusCode}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error sending webhook notification");
|
||||
SentrySdk.CaptureException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,12 +100,12 @@ public class WebhookService : IWebhookService
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning($"Failed to send webhook message. Status: {response.StatusCode}");
|
||||
throw new Exception($"Failed to send webhook message. Status: {response.StatusCode}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error sending webhook message");
|
||||
SentrySdk.CaptureException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user