Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editoast: make 'Result' more flexible #7074

Merged
merged 1 commit into from
Apr 3, 2024
Merged

Conversation

woshilapin
Copy link
Contributor

When defining a new Result, it's sometimes annoying having a Result available and trying to use it as Result<T, E> but actually, there is only one generic argument.

Replacing type Result<T> = StdResult<T, InternalError> by type Result<T, E = InternalError> = StdResult<T, E> keep the bonus of using a custom Result (always returning our InternalError) but leaving the possibility to opt-out easily by specifying the second generic argument.

Note: this seems to alleviate the CI problem on #6791. If someone is willing to dig more why these two seemingly unrelated things seem to interact, please do and share, I'm curious.

When defining a new `Result`, it's sometimes annoying having a
`Result` available and trying to use it as `Result<T, E>` but actually,
there is only one generic argument.

Replacing `type Result<T> = StdResult<T, InternalError>` by
`type Result<T, E = InternalError> = StdResult<T, E>` keep the
bonus of using a custom `Result` (always returning our `InternalError`)
but leaving the possibility to opt-out easily by specifying the second
generic argument.
@woshilapin woshilapin requested a review from a team as a code owner April 2, 2024 14:15
Copy link

codecov bot commented Apr 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 29.00%. Comparing base (cc2748d) to head (99d4728).
Report is 6 commits behind head on dev.

Additional details and impacted files
@@             Coverage Diff              @@
##                dev    #7074      +/-   ##
============================================
- Coverage     29.00%   29.00%   -0.01%     
  Complexity     2250     2250              
============================================
  Files          1070     1070              
  Lines        132717   132717              
  Branches       2728     2728              
============================================
- Hits          38500    38492       -8     
- Misses        92637    92645       +8     
  Partials       1580     1580              
Flag Coverage Δ
core 80.09% <ø> (ø)
editoast 74.61% <ø> (-0.04%) ⬇️
front 9.31% <ø> (ø)
gateway 2.45% <ø> (ø)
railjson_generator 87.15% <ø> (ø)
tests 83.07% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Contributor

@leovalais leovalais left a comment

Choose a reason for hiding this comment

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

Good idea! That'll make the error revamp much easier 🚀

Copy link
Contributor

@flomonster flomonster left a comment

Choose a reason for hiding this comment

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

Good Idea!

@woshilapin woshilapin added this pull request to the merge queue Apr 3, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 3, 2024
@woshilapin woshilapin added this pull request to the merge queue Apr 3, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 3, 2024
@woshilapin woshilapin added this pull request to the merge queue Apr 3, 2024
Merged via the queue into dev with commit 7385265 Apr 3, 2024
22 checks passed
@woshilapin woshilapin deleted the wsl/feat/result-bonus branch April 3, 2024 15:29
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.

3 participants