Skip to content

Conversation

@tpoliaw
Copy link
Contributor

@tpoliaw tpoliaw commented Dec 3, 2025

If the data for a single run could not be found, it should not prevent
the data for other runs being returned.

The way async-graphql handles this is... odd. By making the resolver
return an Option<Result<T,E>> but only ever actually returning a
Some(_) variant, errors are added to the errors list in the response
and the of the query is executed as expected.

Adding the extra Option layer breaks error handling via the ? operator
which would make the resolver noisy so the inner logic is moved into a
non-object impl block which can then be called and wrapped by the
graphql macro wrapped version of the same method.

@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.64%. Comparing base (0681e6d) to head (8db8527).
⚠️ Report is 1 commits behind head on tiled-error-tolerance.

Files with missing lines Patch % Lines
src/model.rs 0.00% 5 Missing ⚠️
Additional details and impacted files
@@                  Coverage Diff                   @@
##           tiled-error-tolerance      #82   +/-   ##
======================================================
  Coverage                  49.64%   49.64%           
======================================================
  Files                         13       13           
  Lines                        560      560           
======================================================
  Hits                         278      278           
  Misses                       282      282           

☔ 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.

If the data for a single run could not be found, it should not prevent
the data for other runs being returned.

The way async-graphql handles this is... odd. By making the resolver
return an Option<Result<T,E>> but only ever actually returning a Some(_)
variant, errors are added to the errors list in the response and the
rest of the query is executed as expected.

Adding the extra Option layer breaks error handling via the ? operator
which would make the resolver noisy so the inner logic is moved into a
non-object impl block which can then be called and wrapped by the
graphql macro wrapped version of the same method.
@tpoliaw tpoliaw linked an issue Dec 3, 2025 that may be closed by this pull request
Copy link
Contributor

@abbiemery abbiemery left a comment

Choose a reason for hiding this comment

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

The combination of these prs makes things much nicer. Tests would be good with a combined call that has successes and errors.

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.

Handle errors from data look up

3 participants