Repository navigation
Conversation
commit: |
|
Hey @jrandolf, Thanks for the PR! This is definitely a breaking change. I'm not opposed to it, but I'm curious why you think it is lossy? All information is retained, and If you are capturing a result object in the first place then by definition you are already preventing code upwards on the stack from seeing the throw value. In order to re-expose the stack to the error, you are would already need to destructure via the Or is the problem that Effection itself does not do this when it re-throws an error? That would definitely be a problem |
|
Yes. Effection itself rethrows the wrapper. #1149 established Changing This PR changes the common representation instead. SvelteKit shows why that matters. Its |
|
Right. This could be a change that could be accepted as part of a 5.0 release, but since it breaks a public API, it cannot go into the v4 release series as-is. However, failure to unbox is a bug in v4 and should be fixed. |
|
I think the path forward here is to start a v5 branch with this as the first change on it, and then add the unwrapping behavior to v4. Is that latter item something you'd be willing to take on? |
|
Let's do it! |
|
@cowboyd I opened #1230 with the v4-compatible fix: explicit |
|
@cowboyd Will you create the v5 branch? I don't have permission for this. |
|
@jrandolf done! |
a00070f to
f4ceb1b
Compare
|
@cowboyd This PR is ready! |
|
As long as we're making a breaking change, would it make sense to change the name of the field to |
|
Done |
| @@ -1,4 +1,5 @@ | |||
| { | |||
| "name": "effection-benchmarks", | |||
There was a problem hiding this comment.
Yes. I reproduced the benchmark install failure locally: without a package name, npm's audit crashes with Cannot read properties of null (reading 'name').
I've thought about it and But this is up to you. |
Motivation
Preserve non-
Errorthrown values in explicit results for v5, and rename the failure field as requested.Approach
Use
{ ok: false, cause: unknown }for failed results.Err()retains the original value withoutThrownValueError; runtime consumers and documentation usecause. #1264 adds the v4 alias and deprecateserror.Fix CI by naming the benchmark package to prevent npm's audit crash. Local tests, formatting, lint, type checks, and the Node test build pass.