Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute retry logic in Send() method even if exception is not of type WebException #25

Open
wants to merge 3 commits into
base: master
from
Open
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Update loggly client to catch all exceptions during send and execute …

…retry logic so as to not cause the client to crash during an unexpected exception.
  • Loading branch information
MikeMugu committed Apr 25, 2019
commit 16d05326162d9b8c4a126d184dca63e0e8b17e88
@@ -32,17 +32,20 @@ public void Send(string[] messagesBuffer, int numberOfMessages)
SendToLoggly(message);
break;
}
catch (WebException e)
catch (Exception e)
{
var response = (HttpWebResponse)e.Response;
if (response != null && response.StatusCode == HttpStatusCode.Forbidden)
if (e is WebException)
{
_isTokenValid = false;
ErrorReporter.ReportError($"LogglyClient: Provided Loggly customer token '{_config.CustomerToken}' is invalid. No logs will be sent to Loggly.");
}
else
{
ErrorReporter.ReportError($"LogglyClient: Error sending logs to Loggly: {e.Message}");
var response = ((WebException)e).Response as HttpWebResponse;
if (response != null && response.StatusCode == HttpStatusCode.Forbidden)
{
_isTokenValid = false;
ErrorReporter.ReportError($"LogglyClient: Provided Loggly customer token '{_config.CustomerToken}' is invalid. No logs will be sent to Loggly.");
}
else
{
ErrorReporter.ReportError($"LogglyClient: Error sending logs to Loggly: {e.Message}");
}
}

currentRetry++;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.