Skip to content

Conversation

@henriquemoody
Copy link
Member

Currently, the only way to handle when a validation fails is by assert(), which either throws an exception or doesn't. That means that every time a user wants to handle the results, they must use try-catch blocks, which may add some overhead.

This commit introduces the ResultQuery class that wraps a Result object, providing an alternative to exception-based validation. This allows users to handle results directly without try-catch blocks.

I’m taking a risky move here using the old method validate(), but I can’t think of a better name for this method.

@henriquemoody henriquemoody changed the title Enable validating inputs without throwing exceptions. Enable validating inputs without throwing exceptions Dec 22, 2025
@codecov
Copy link

codecov bot commented Dec 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.49%. Comparing base (5b00d69) to head (16c2a75).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1566      +/-   ##
============================================
+ Coverage     97.43%   97.49%   +0.06%     
- Complexity      950      977      +27     
============================================
  Files           204      205       +1     
  Lines          2144     2199      +55     
============================================
+ Hits           2089     2144      +55     
  Misses           55       55              

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

@henriquemoody henriquemoody force-pushed the core/result-query branch 2 times, most recently from 7b3f724 to b7c8fa5 Compare December 22, 2025 18:03
alganet
alganet previously approved these changes Dec 22, 2025
Currently, the only way to handle when a validation fails is by
`assert()`, which either throws an exception or doesn't. That means that
every time a user wants to handle the results, they must use try-catch
blocks, which may add some overhead.

This commit introduces the `ResultQuery` class that wraps a `Result`
object, providing an alternative to exception-based validation. This
allows users to handle results directly without try-catch blocks.

I’m taking a risky move here using the old method `validate()`, but I
can’t think of a better name for this method.
@henriquemoody henriquemoody merged commit 16c2a75 into Respect:main Dec 22, 2025
5 checks passed
@henriquemoody henriquemoody deleted the core/result-query branch December 22, 2025 19:39
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.

2 participants