Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Added original exception to FailureCallback action #449

Merged
merged 1 commit into from
Apr 4, 2023

Conversation

Towmeykaw
Copy link
Contributor

What issue does this PR address?
#381

Does this PR introduce a breaking change?
Yes

Please check if the PR fulfills these requirements

  • The commit follows our guidelines
  • Unit Tests for the changes have been added (for bug fixes / features)

Other information:
At first I thought it would be nice to populate the Exception in the Logevent but unfortunately it had no setter. So had to be a breaking change instead

@AlexGoris-KasparSolutions

Can we get this merged, I need exactly this to investigate why I get elastic failures every now and then :)

@@ -242,7 +242,7 @@ private void HandleResponse(IEnumerable<LogEvent> events, DynamicResponse result
// Send to a failure callback
try
{
_state.Options.FailureCallback(e);
_state.Options.FailureCallback(e, null);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should find a way to raise a meaningful exception here as well. I did a test with 403 response from elastic and ended up here but the null doesn't tell anything to the higher-up code.
This gives me usable information to act upon (copied selflog from line 216):

 _state.Options.FailureCallback(e, new Exception(string.Format("Failed to store event with template '{0}' into Elasticsearch. Elasticsearch reports for index {1} the following: {2}",
                                e.MessageTemplate,
                                action["_index"],
                                _state.Serialize(action["error"]))));

@netclectic
Copy link

Is this ever going to get merged?
It seems like a massive oversight that this wasn't included from day 1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants