🐛 unwrap non-Error runtime failures - #1230
Conversation
commit: |
Merging this PR will degrade performance by 22.68%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Memory | effection-inline.recursion |
4.7 KB | 6.1 KB | -22.68% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing jrandolf:jrandolf/unbox-thrown-values (58a048d) with v4 (70ddc1c)
|
@jrandolf Looks good. There is one potential regression: I don't think that the type of Whereas before, we knew all throws would be boxed in an error, we don't anymore because we could (and should) see the original cause. I think now As it stands, if someone throws "null" or "0" or "false" it won't print anything. A minor thing, but it should actually simplify the type and remove the need for the type assertion on https://github.com/thefrontside/effection/blob/v4/lib/main.ts#L139
|
Motivation
Effection v4 deliberately keeps
Result.errortyped asError, wrapping non-Errorcauses inThrownValueError. Automatic propagation currently rethrows or rejects that wrapper, so caught values lose their original identity and runtime guards such asinstanceoffail. This is the v4-compatible follow-up discussed in #1229.Approach
Resultvalues wrapped asErrorunbox()behaviorValidation:
deno fmt,deno lint,deno check mod.ts experimental.ts, and the full 235-step test suite.