-
Notifications
You must be signed in to change notification settings - Fork 451
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
WIP: Pass Trace transparently through withError #3358
Draft
kyay10
wants to merge
25
commits into
arrow-2
Choose a base branch
from
kyay10/with-error-traced
base: arrow-2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
af2aedd
Pass Trace transparently through withError.
kyay10 30040fd
Merge branch 'arrow-2' into kyay10/with-error-traced
kyay10 90c27f9
Branch was auto-updated.
github-actions[bot] d699c88
Add Raise.underlyingRaise with default implementation
kyay10 3c100b8
Branch was auto-updated.
github-actions[bot] 1c533d7
Branch was auto-updated.
github-actions[bot] 9d8dbb9
Branch was auto-updated.
github-actions[bot] 158242e
Branch was auto-updated.
github-actions[bot] 4886dde
Branch was auto-updated.
github-actions[bot] d028021
Branch was auto-updated.
github-actions[bot] 341931e
Branch was auto-updated.
github-actions[bot] a63eeaf
Branch was auto-updated.
github-actions[bot] cef9426
Branch was auto-updated.
github-actions[bot] 9317bb7
Branch was auto-updated.
github-actions[bot] 75db109
Branch was auto-updated.
github-actions[bot] 6247698
Branch was auto-updated.
github-actions[bot] c962527
Branch was auto-updated.
github-actions[bot] 4999684
Branch was auto-updated.
github-actions[bot] 9980d54
Branch was auto-updated.
github-actions[bot] 1e61243
Branch was auto-updated.
github-actions[bot] 29d8c07
Branch was auto-updated.
github-actions[bot] 5a48eb4
Branch was auto-updated.
github-actions[bot] f49df4f
Branch was auto-updated.
github-actions[bot] 47cb3e6
Branch was auto-updated.
github-actions[bot] 9ed9b46
Branch was auto-updated.
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, for me this is a no-go, we really want to keep this one open for extension (we even talk about that in the docs).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that I'm keeping it open by instead providing
RaiseWrapper
andTransformingRaise
. Those 2 are the only use cases that I can observe. Most people will useRaiseWrapper
if they're just defining an intersection type (and we can deprecate it when contexts are stable).TransformingRaise
is another pattern where one wants to change the error type right then and there (used inRaiseAccumulate
andSingletonRaise
), and it's slightly more performance thanwithError
.Instead of this change, would you prefer we force implementors to provide a
val underlyingRaise: Raise<*>
or something along those lines? I didn't want to go through that approach because one can doval underlyingRaise get() = this
which I heavily dislikeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @serras. I understand it's still open for extension, but not in a straightforward way.
Did not yet have the time to properly dive into this, but perhaps we can find a different solution. Perhaps going the other-way around might be better. Something like
CoroutineStackFrame
which you can optionally implement, if you need behavior like this one.We can dynamically check if a
Raise
interface implementsRaiseFrame
, or similar and then we'd get access to additional properties. That would probably even be possible to add in 1.xNo idea if any of this would work, just spitting some ideas☺️ Will make some time asap to look into this issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've head of teams using
CoroutineContext
to pass this information, but unfortunately we don't havesuspend
in ourraise
function.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about introducing some form of
interface RaiseWrapper<Error>: Raise<Error> { val underlyingRaise: Raise<*> }
and encouraging users to gradually use it? We can support this feature then for those implementors. Alternatively, we can add anval underlyingRaise
intoRaise
directly, with a default impl of returningthis
, although this would be a 2.0 feature.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'm also getting distracted by thinking too far into the future. With contexts, we don't want "delegating" implementors of
Raise
, because they can always be replaced by composingRaise
and the class in question. Instead, we want "transforming" implementors that actually do something interesting with the error value. Maybe that, as a plan, is unnecessarily ambitious. I'll experiment here with simplifying this, focusing on requiring as little migration as possible.