Skip to content

Add return value to CaptureFeedback #4319

@bitsandfoxes

Description

@bitsandfoxes

Description

Problem Statement

CaptureFeedback is a user facing (not just our users, but actually our users' user) method, where there is no way to validate successful capture right now.

Context

public static void CaptureFeedback(SentryFeedback feedback, Action<Scope> configureScope, SentryHint? hint = null)

CaptureFeedback returns void right now. There are multiple conditions why the SDK might fail to send the feedback
CaptureFeedback(feedback, clonedScope, hint);
}
catch (Exception e)
{
_options.LogError(e, "Failure to capture feedback");
}

if (string.IsNullOrEmpty(feedback.Message))
{
_options.LogWarning("Feedback dropped due to empty message.");
return;
}

The feedback could be dropped and without reading the logs, users will never know that it happened.
Capturing the feedback ends with a call to CaptureEnvelope which does return a bool but that gets swallowed right now.

var attachments = hint.Attachments.ToList();
var envelope = Envelope.FromFeedback(evt, _options.DiagnosticLogger, attachments, scope.SessionUpdate);
CaptureEnvelope(envelope);

Proposal

Similar to how it is done in CaptureEvent calling CaptureFeedback should return the event ID.

try
{
return DoSendEvent(@event, hint, scope);
}
catch (Exception e)
{
_options.LogError(e, "An error occurred when capturing the event {0}.", @event.EventId);
return SentryId.Empty;
}

This would allow

  1. Users to validate whether the event/feedback was actually sent
  2. Users to display the captured event ID to their users

Metadata

Metadata

No fields configured for issues without a type.

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions