Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

jamescrosswell
Copy link
Collaborator

@jamescrosswell jamescrosswell commented Oct 9, 2025

SentrySdk.CaptureFeedback now returns a CaptureFeedbackResult that returns:

  • either the id of the newly captured feedback (if the call succeeds)
  • or SentryId.Empty and an error code (if the call fails)

Resolves #4319

src/Sentry/ISentryClient.cs Outdated Show resolved Hide resolved
Copy link

codecov bot commented Oct 9, 2025

Codecov Report

❌ Patch coverage is 76.00000% with 6 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (version6@c32dfbb). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/Sentry/CaptureFeedbackResult.cs 80.00% 1 Missing and 1 partial ⚠️
src/Sentry/Extensibility/DisabledHub.cs 0.00% 2 Missing ⚠️
src/Sentry/Internal/Hub.cs 66.66% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             version6    #4613   +/-   ##
===========================================
  Coverage            ?   73.08%           
===========================================
  Files               ?      480           
  Lines               ?    17394           
  Branches            ?     3434           
===========================================
  Hits                ?    12713           
  Misses              ?     3821           
  Partials            ?      860           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jamescrosswell jamescrosswell marked this pull request as ready for review October 9, 2025 05:50
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

src/Sentry/SentryClient.cs Outdated Show resolved Hide resolved
src/Sentry/SentryClient.cs Outdated Show resolved Hide resolved
src/Sentry/ISentryClient.cs Outdated Show resolved Hide resolved
@bitsandfoxes
Copy link
Contributor

This looks great from the SDK for Unity POV.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

src/Sentry/SentryClient.cs Outdated Show resolved Hide resolved
Sentry.SentryStructuredLogger Logger { get; }
void BindException(System.Exception exception, Sentry.ISpan span);
Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action<Sentry.Scope> configureScope);
Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action<Sentry.Scope> configureScope);
Copy link
Member

@Flash0ver Flash0ver Oct 15, 2025

Choose a reason for hiding this comment

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

question: Is it worth considering having more returns of SentryId ... potentially in a follow-up issue/PR?

  • CaptureTransaction
  • CaptureSession

Copy link
Collaborator Author

@jamescrosswell jamescrosswell Oct 16, 2025

Choose a reason for hiding this comment

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

I don't think so. Those methods aren't user facing (they're SDK user facing). This method is an exception in that there will be some UI around it in the app and so some feedback is required for the actual user (not just the SDK user).

Certainly nobody has ever asked for this...

public SentryId EventId;

/// <inheritdoc cref="CaptureFeedbackErrorReason"/>
public CaptureFeedbackErrorReason? ErrorReason;
Copy link
Member

@Flash0ver Flash0ver Oct 15, 2025

Choose a reason for hiding this comment

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

thought: Nullable<T> vs non-nullable

I am a bit hesitant about a Nullable<enum>.
I'm thinking about having an additional 0 value in the enum, like None.
Or alternatively something like Done or Succeeded and calling the enum instead CaptureFeedbackStatus.
Similar to

I do prefer the latter ... but personal preference ... I'm convincible 😉

Copy link
Collaborator Author

@jamescrosswell jamescrosswell Oct 16, 2025

Choose a reason for hiding this comment

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

I tried that but it means we have to do weird stuff like this in one of the constructors:

    public CaptureFeedbackResult(CaptureFeedbackResultStatus resultStatus)
    {
        if (resultStatus == CaptureFeedbackResultStatus.Success)
        {
            throw new ArgumentException("Use alternate constructor to indicate success.", nameof(resultStatus));
        }

        EventId = SentryId.Empty;
        ResultStatus = resultStatus;
    }

I think that's just as messy personally. I don't think the current design is any better or worse than the alternatives then.

Note

This is one good use case for a Nominal Discriminating Union... but we don't have those yet.

src/Sentry/CaptureFeedbackResult.cs Outdated Show resolved Hide resolved
src/Sentry/CaptureFeedbackResult.cs Outdated Show resolved Hide resolved
src/Sentry/CaptureFeedbackResult.cs Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't dispose of backpressure monitor when disposing the Hub Add return value to CaptureFeedback

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.