effect 3.22.3 → 3.22.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/BigDecimal.js +4 -3
- package/dist/cjs/BigDecimal.js.map +1 -1
- package/dist/cjs/Duration.js +10 -3
- package/dist/cjs/Duration.js.map +1 -1
- package/dist/cjs/Effect.js +49 -35
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/LayerMap.js +4 -3
- package/dist/cjs/LayerMap.js.map +1 -1
- package/dist/cjs/Micro.js +4 -3
- package/dist/cjs/Micro.js.map +1 -1
- package/dist/cjs/Stream.js +1 -1
- package/dist/cjs/internal/cause.js +6 -5
- package/dist/cjs/internal/cause.js.map +1 -1
- package/dist/cjs/internal/context.js +10 -9
- package/dist/cjs/internal/context.js.map +1 -1
- package/dist/cjs/internal/core-effect.js +4 -3
- package/dist/cjs/internal/core-effect.js.map +1 -1
- package/dist/cjs/internal/effect/circular.js +2 -2
- package/dist/cjs/internal/effect/circular.js.map +1 -1
- package/dist/cjs/internal/layer.js +4 -3
- package/dist/cjs/internal/layer.js.map +1 -1
- package/dist/cjs/internal/logger.js +11 -2
- package/dist/cjs/internal/logger.js.map +1 -1
- package/dist/cjs/internal/pubsub.js +12 -24
- package/dist/cjs/internal/pubsub.js.map +1 -1
- package/dist/cjs/internal/runtime.js +14 -8
- package/dist/cjs/internal/runtime.js.map +1 -1
- package/dist/cjs/internal/stackTraceLimit.js +49 -0
- package/dist/cjs/internal/stackTraceLimit.js.map +1 -0
- package/dist/cjs/internal/tracer.js +4 -3
- package/dist/cjs/internal/tracer.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/Duration.d.ts.map +1 -1
- package/dist/dts/Effect.d.ts +43 -43
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/LayerMap.d.ts.map +1 -1
- package/dist/dts/Micro.d.ts.map +1 -1
- package/dist/dts/Stream.d.ts +1 -1
- package/dist/dts/internal/context.d.ts.map +1 -1
- package/dist/dts/internal/core-effect.d.ts.map +1 -1
- package/dist/dts/internal/layer.d.ts.map +1 -1
- package/dist/dts/internal/stackTraceLimit.d.ts +2 -0
- package/dist/dts/internal/stackTraceLimit.d.ts.map +1 -0
- package/dist/esm/BigDecimal.js +4 -3
- package/dist/esm/BigDecimal.js.map +1 -1
- package/dist/esm/Duration.js +10 -3
- package/dist/esm/Duration.js.map +1 -1
- package/dist/esm/Effect.js +49 -35
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/LayerMap.js +4 -3
- package/dist/esm/LayerMap.js.map +1 -1
- package/dist/esm/Micro.js +4 -3
- package/dist/esm/Micro.js.map +1 -1
- package/dist/esm/Stream.js +1 -1
- package/dist/esm/internal/cause.js +6 -5
- package/dist/esm/internal/cause.js.map +1 -1
- package/dist/esm/internal/context.js +10 -9
- package/dist/esm/internal/context.js.map +1 -1
- package/dist/esm/internal/core-effect.js +4 -3
- package/dist/esm/internal/core-effect.js.map +1 -1
- package/dist/esm/internal/effect/circular.js +2 -2
- package/dist/esm/internal/effect/circular.js.map +1 -1
- package/dist/esm/internal/layer.js +4 -3
- package/dist/esm/internal/layer.js.map +1 -1
- package/dist/esm/internal/logger.js +10 -1
- package/dist/esm/internal/logger.js.map +1 -1
- package/dist/esm/internal/pubsub.js +12 -24
- package/dist/esm/internal/pubsub.js.map +1 -1
- package/dist/esm/internal/runtime.js +14 -8
- package/dist/esm/internal/runtime.js.map +1 -1
- package/dist/esm/internal/stackTraceLimit.js +40 -0
- package/dist/esm/internal/stackTraceLimit.js.map +1 -0
- package/dist/esm/internal/tracer.js +4 -3
- package/dist/esm/internal/tracer.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/BigDecimal.ts +4 -4
- package/src/Duration.ts +12 -3
- package/src/Effect.ts +73 -59
- package/src/LayerMap.ts +4 -3
- package/src/Micro.ts +4 -3
- package/src/Stream.ts +1 -1
- package/src/internal/cause.ts +6 -5
- package/src/internal/context.ts +10 -9
- package/src/internal/core-effect.ts +4 -3
- package/src/internal/effect/circular.ts +22 -24
- package/src/internal/layer.ts +4 -3
- package/src/internal/logger.ts +9 -1
- package/src/internal/pubsub.ts +13 -25
- package/src/internal/runtime.ts +14 -8
- package/src/internal/stackTraceLimit.ts +65 -0
- package/src/internal/tracer.ts +4 -3
- package/src/internal/version.ts +1 -1
package/src/Effect.ts
CHANGED
|
@@ -40,6 +40,7 @@ import * as option_ from "./internal/option.js"
|
|
|
40
40
|
import * as query from "./internal/query.js"
|
|
41
41
|
import * as runtime_ from "./internal/runtime.js"
|
|
42
42
|
import * as schedule_ from "./internal/schedule.js"
|
|
43
|
+
import { getStackTraceLimit, setStackTraceLimit } from "./internal/stackTraceLimit.js"
|
|
43
44
|
import * as internalTracer from "./internal/tracer.js"
|
|
44
45
|
import type * as Layer from "./Layer.js"
|
|
45
46
|
import type * as LogLevel from "./LogLevel.js"
|
|
@@ -1023,7 +1024,7 @@ export const once: <A, E, R>(self: Effect<A, E, R>) => Effect<Effect<void, E, R>
|
|
|
1023
1024
|
* // {
|
|
1024
1025
|
* // _id: 'Exit',
|
|
1025
1026
|
* // _tag: 'Failure',
|
|
1026
|
-
* // cause: { _id: 'Cause', _tag: 'Fail',
|
|
1027
|
+
* // cause: { _id: 'Cause', _tag: 'Fail', error: 'Task2: Oh no!' }
|
|
1027
1028
|
* // }
|
|
1028
1029
|
* ```
|
|
1029
1030
|
*
|
|
@@ -1078,7 +1079,7 @@ export const once: <A, E, R>(self: Effect<A, E, R>) => Effect<Effect<void, E, R>
|
|
|
1078
1079
|
* // cause: {
|
|
1079
1080
|
* // _id: 'Cause',
|
|
1080
1081
|
* // _tag: 'Fail',
|
|
1081
|
-
* //
|
|
1082
|
+
* // error: [
|
|
1082
1083
|
* // { _id: 'Option', _tag: 'None' },
|
|
1083
1084
|
* // { _id: 'Option', _tag: 'Some', value: 'Task2: Oh no!' },
|
|
1084
1085
|
* // { _id: 'Option', _tag: 'None' }
|
|
@@ -4399,7 +4400,7 @@ export const replicateEffect: {
|
|
|
4399
4400
|
* // cause: {
|
|
4400
4401
|
* // _id: 'Cause',
|
|
4401
4402
|
* // _tag: 'Fail',
|
|
4402
|
-
* //
|
|
4403
|
+
* // error: [ '4 is not less that 4', '5 is not less that 4' ]
|
|
4403
4404
|
* // }
|
|
4404
4405
|
* // }
|
|
4405
4406
|
* ```
|
|
@@ -4460,7 +4461,7 @@ export const validateAll: {
|
|
|
4460
4461
|
* // cause: {
|
|
4461
4462
|
* // _id: 'Cause',
|
|
4462
4463
|
* // _tag: 'Fail',
|
|
4463
|
-
* //
|
|
4464
|
+
* // error: [ '4 is not less that 4', '5 is not less that 4' ]
|
|
4464
4465
|
* // }
|
|
4465
4466
|
* // }
|
|
4466
4467
|
* ```
|
|
@@ -4529,7 +4530,7 @@ export const validateAll: {
|
|
|
4529
4530
|
* // cause: {
|
|
4530
4531
|
* // _id: 'Cause',
|
|
4531
4532
|
* // _tag: 'Fail',
|
|
4532
|
-
* //
|
|
4533
|
+
* // error: [ '4 is not less that 4', '5 is not less that 4' ]
|
|
4533
4534
|
* // }
|
|
4534
4535
|
* // }
|
|
4535
4536
|
* ```
|
|
@@ -4598,7 +4599,7 @@ export const validateAll: {
|
|
|
4598
4599
|
* // cause: {
|
|
4599
4600
|
* // _id: 'Cause',
|
|
4600
4601
|
* // _tag: 'Fail',
|
|
4601
|
-
* //
|
|
4602
|
+
* // error: [ '4 is not less that 4', '5 is not less that 4' ]
|
|
4602
4603
|
* // }
|
|
4603
4604
|
* // }
|
|
4604
4605
|
* ```
|
|
@@ -4668,7 +4669,7 @@ export const validateAll: {
|
|
|
4668
4669
|
* // cause: {
|
|
4669
4670
|
* // _id: 'Cause',
|
|
4670
4671
|
* // _tag: 'Fail',
|
|
4671
|
-
* //
|
|
4672
|
+
* // error: [ '4 is not less that 4', '5 is not less that 4' ]
|
|
4672
4673
|
* // }
|
|
4673
4674
|
* // }
|
|
4674
4675
|
* ```
|
|
@@ -7779,7 +7780,7 @@ export const ignoreLogged: <A, E, R>(self: Effect<A, E, R>) => Effect<void, neve
|
|
|
7779
7780
|
* // {
|
|
7780
7781
|
* // _id: 'Exit',
|
|
7781
7782
|
* // _tag: 'Failure',
|
|
7782
|
-
* // cause: { _id: 'Cause', _tag: 'Fail',
|
|
7783
|
+
* // cause: { _id: 'Cause', _tag: 'Fail', error: [ 'Oh uh!', 'Oh no!' ] }
|
|
7783
7784
|
* // }
|
|
7784
7785
|
* ```
|
|
7785
7786
|
*
|
|
@@ -7993,7 +7994,7 @@ export declare namespace Retry {
|
|
|
7993
7994
|
* // {
|
|
7994
7995
|
* // _id: 'Exit',
|
|
7995
7996
|
* // _tag: 'Failure',
|
|
7996
|
-
* // cause: { _id: 'Cause', _tag: 'Fail',
|
|
7997
|
+
* // cause: { _id: 'Cause', _tag: 'Fail', error: 'Error 3' }
|
|
7997
7998
|
* // }
|
|
7998
7999
|
* ```
|
|
7999
8000
|
*
|
|
@@ -8112,7 +8113,7 @@ export const retry: {
|
|
|
8112
8113
|
* // {
|
|
8113
8114
|
* // _id: 'Exit',
|
|
8114
8115
|
* // _tag: 'Failure',
|
|
8115
|
-
* // cause: { _id: 'Cause', _tag: 'Fail',
|
|
8116
|
+
* // cause: { _id: 'Cause', _tag: 'Fail', error: 'Error 3' }
|
|
8116
8117
|
* // }
|
|
8117
8118
|
* ```
|
|
8118
8119
|
*
|
|
@@ -8231,7 +8232,7 @@ export const retry: {
|
|
|
8231
8232
|
* // {
|
|
8232
8233
|
* // _id: 'Exit',
|
|
8233
8234
|
* // _tag: 'Failure',
|
|
8234
|
-
* // cause: { _id: 'Cause', _tag: 'Fail',
|
|
8235
|
+
* // cause: { _id: 'Cause', _tag: 'Fail', error: 'Error 3' }
|
|
8235
8236
|
* // }
|
|
8236
8237
|
* ```
|
|
8237
8238
|
*
|
|
@@ -8350,7 +8351,7 @@ export const retry: {
|
|
|
8350
8351
|
* // {
|
|
8351
8352
|
* // _id: 'Exit',
|
|
8352
8353
|
* // _tag: 'Failure',
|
|
8353
|
-
* // cause: { _id: 'Cause', _tag: 'Fail',
|
|
8354
|
+
* // cause: { _id: 'Cause', _tag: 'Fail', error: 'Error 3' }
|
|
8354
8355
|
* // }
|
|
8355
8356
|
* ```
|
|
8356
8357
|
*
|
|
@@ -8469,7 +8470,7 @@ export const retry: {
|
|
|
8469
8470
|
* // {
|
|
8470
8471
|
* // _id: 'Exit',
|
|
8471
8472
|
* // _tag: 'Failure',
|
|
8472
|
-
* // cause: { _id: 'Cause', _tag: 'Fail',
|
|
8473
|
+
* // cause: { _id: 'Cause', _tag: 'Fail', error: 'Error 3' }
|
|
8473
8474
|
* // }
|
|
8474
8475
|
* ```
|
|
8475
8476
|
*
|
|
@@ -9204,7 +9205,7 @@ export const checkInterruptible: <A, E, R>(f: (isInterruptible: boolean) => Effe
|
|
|
9204
9205
|
* // cause: {
|
|
9205
9206
|
* // _id: 'Cause',
|
|
9206
9207
|
* // _tag: 'Fail',
|
|
9207
|
-
* //
|
|
9208
|
+
* // error: { _tag: 'TimeoutException' }
|
|
9208
9209
|
* // }
|
|
9209
9210
|
* // }
|
|
9210
9211
|
* // Heavy processing done.
|
|
@@ -10859,7 +10860,7 @@ export const acquireUseRelease: {
|
|
|
10859
10860
|
* // {
|
|
10860
10861
|
* // _id: 'Exit',
|
|
10861
10862
|
* // _tag: 'Failure',
|
|
10862
|
-
* // cause: { _id: 'Cause', _tag: 'Fail',
|
|
10863
|
+
* // cause: { _id: 'Cause', _tag: 'Fail', error: 'Uh oh!' }
|
|
10863
10864
|
* // }
|
|
10864
10865
|
* ```
|
|
10865
10866
|
*
|
|
@@ -13300,7 +13301,7 @@ export const timedWith: {
|
|
|
13300
13301
|
* // cause: {
|
|
13301
13302
|
* // _id: 'Cause',
|
|
13302
13303
|
* // _tag: 'Fail',
|
|
13303
|
-
* //
|
|
13304
|
+
* // error: { _tag: 'TimeoutException' }
|
|
13304
13305
|
* // }
|
|
13305
13306
|
* // }
|
|
13306
13307
|
* ```
|
|
@@ -13356,7 +13357,7 @@ export const timeout: {
|
|
|
13356
13357
|
* // cause: {
|
|
13357
13358
|
* // _id: 'Cause',
|
|
13358
13359
|
* // _tag: 'Fail',
|
|
13359
|
-
* //
|
|
13360
|
+
* // error: { _tag: 'TimeoutException' }
|
|
13360
13361
|
* // }
|
|
13361
13362
|
* // }
|
|
13362
13363
|
* ```
|
|
@@ -13412,7 +13413,7 @@ export const timeout: {
|
|
|
13412
13413
|
* // cause: {
|
|
13413
13414
|
* // _id: 'Cause',
|
|
13414
13415
|
* // _tag: 'Fail',
|
|
13415
|
-
* //
|
|
13416
|
+
* // error: { _tag: 'TimeoutException' }
|
|
13416
13417
|
* // }
|
|
13417
13418
|
* // }
|
|
13418
13419
|
* ```
|
|
@@ -13653,7 +13654,7 @@ export const timeoutOption: {
|
|
|
13653
13654
|
* // cause: {
|
|
13654
13655
|
* // _id: 'Cause',
|
|
13655
13656
|
* // _tag: 'Fail',
|
|
13656
|
-
* //
|
|
13657
|
+
* // error: MyTimeoutError { _tag: 'MyTimeoutError' }
|
|
13657
13658
|
* // }
|
|
13658
13659
|
* // }
|
|
13659
13660
|
* ```
|
|
@@ -13719,7 +13720,7 @@ export const timeoutFail: {
|
|
|
13719
13720
|
* // cause: {
|
|
13720
13721
|
* // _id: 'Cause',
|
|
13721
13722
|
* // _tag: 'Fail',
|
|
13722
|
-
* //
|
|
13723
|
+
* // error: MyTimeoutError { _tag: 'MyTimeoutError' }
|
|
13723
13724
|
* // }
|
|
13724
13725
|
* // }
|
|
13725
13726
|
* ```
|
|
@@ -13787,7 +13788,7 @@ export const timeoutFail: {
|
|
|
13787
13788
|
* // cause: {
|
|
13788
13789
|
* // _id: 'Cause',
|
|
13789
13790
|
* // _tag: 'Fail',
|
|
13790
|
-
* //
|
|
13791
|
+
* // error: MyTimeoutError { _tag: 'MyTimeoutError' }
|
|
13791
13792
|
* // }
|
|
13792
13793
|
* // }
|
|
13793
13794
|
* ```
|
|
@@ -18473,8 +18474,8 @@ export const flatten: <A, E1, R1, E, R>(self: Effect<Effect<A, E1, R1>, E, R>) =
|
|
|
18473
18474
|
* // cause: {
|
|
18474
18475
|
* // _id: 'Cause',
|
|
18475
18476
|
* // _tag: 'Parallel',
|
|
18476
|
-
* // left: { _id: 'Cause', _tag: 'Fail',
|
|
18477
|
-
* // right: { _id: 'Cause', _tag: 'Fail',
|
|
18477
|
+
* // left: { _id: 'Cause', _tag: 'Fail', error: 'task1' },
|
|
18478
|
+
* // right: { _id: 'Cause', _tag: 'Fail', error: 'task2' }
|
|
18478
18479
|
* // }
|
|
18479
18480
|
* // }
|
|
18480
18481
|
* ```
|
|
@@ -18611,8 +18612,8 @@ export const race: {
|
|
|
18611
18612
|
* // cause: {
|
|
18612
18613
|
* // _id: 'Cause',
|
|
18613
18614
|
* // _tag: 'Parallel',
|
|
18614
|
-
* // left: { _id: 'Cause', _tag: 'Fail',
|
|
18615
|
-
* // right: { _id: 'Cause', _tag: 'Fail',
|
|
18615
|
+
* // left: { _id: 'Cause', _tag: 'Fail', error: 'task1' },
|
|
18616
|
+
* // right: { _id: 'Cause', _tag: 'Fail', error: 'task2' }
|
|
18616
18617
|
* // }
|
|
18617
18618
|
* // }
|
|
18618
18619
|
* ```
|
|
@@ -18749,8 +18750,8 @@ export const race: {
|
|
|
18749
18750
|
* // cause: {
|
|
18750
18751
|
* // _id: 'Cause',
|
|
18751
18752
|
* // _tag: 'Parallel',
|
|
18752
|
-
* // left: { _id: 'Cause', _tag: 'Fail',
|
|
18753
|
-
* // right: { _id: 'Cause', _tag: 'Fail',
|
|
18753
|
+
* // left: { _id: 'Cause', _tag: 'Fail', error: 'task1' },
|
|
18754
|
+
* // right: { _id: 'Cause', _tag: 'Fail', error: 'task2' }
|
|
18754
18755
|
* // }
|
|
18755
18756
|
* // }
|
|
18756
18757
|
* ```
|
|
@@ -18899,7 +18900,7 @@ export const race: {
|
|
|
18899
18900
|
* // {
|
|
18900
18901
|
* // _id: 'Exit',
|
|
18901
18902
|
* // _tag: 'Failure',
|
|
18902
|
-
* // cause: { _id: 'Cause', _tag: 'Fail',
|
|
18903
|
+
* // cause: { _id: 'Cause', _tag: 'Fail', error: 'task2' }
|
|
18903
18904
|
* // }
|
|
18904
18905
|
* ```
|
|
18905
18906
|
*
|
|
@@ -19007,7 +19008,7 @@ export const raceAll: <Eff extends Effect<any, any, any>>(
|
|
|
19007
19008
|
* // {
|
|
19008
19009
|
* // _id: 'Exit',
|
|
19009
19010
|
* // _tag: 'Failure',
|
|
19010
|
-
* // cause: { _id: 'Cause', _tag: 'Fail',
|
|
19011
|
+
* // cause: { _id: 'Cause', _tag: 'Fail', error: 'task1' }
|
|
19011
19012
|
* // }
|
|
19012
19013
|
* ```
|
|
19013
19014
|
*
|
|
@@ -19144,7 +19145,7 @@ export const raceFirst: {
|
|
|
19144
19145
|
* // {
|
|
19145
19146
|
* // _id: 'Exit',
|
|
19146
19147
|
* // _tag: 'Failure',
|
|
19147
|
-
* // cause: { _id: 'Cause', _tag: 'Fail',
|
|
19148
|
+
* // cause: { _id: 'Cause', _tag: 'Fail', error: 'task1' }
|
|
19148
19149
|
* // }
|
|
19149
19150
|
* ```
|
|
19150
19151
|
*
|
|
@@ -19281,7 +19282,7 @@ export const raceFirst: {
|
|
|
19281
19282
|
* // {
|
|
19282
19283
|
* // _id: 'Exit',
|
|
19283
19284
|
* // _tag: 'Failure',
|
|
19284
|
-
* // cause: { _id: 'Cause', _tag: 'Fail',
|
|
19285
|
+
* // cause: { _id: 'Cause', _tag: 'Fail', error: 'task1' }
|
|
19285
19286
|
* // }
|
|
19286
19287
|
* ```
|
|
19287
19288
|
*
|
|
@@ -24425,7 +24426,7 @@ export const orElse: {
|
|
|
24425
24426
|
* // {
|
|
24426
24427
|
* // _id: 'Exit',
|
|
24427
24428
|
* // _tag: 'Failure',
|
|
24428
|
-
* // cause: { _id: 'Cause', _tag: 'Fail',
|
|
24429
|
+
* // cause: { _id: 'Cause', _tag: 'Fail', error: 'invalid age' }
|
|
24429
24430
|
* // }
|
|
24430
24431
|
* ```
|
|
24431
24432
|
*
|
|
@@ -24475,7 +24476,7 @@ export const orElseFail: {
|
|
|
24475
24476
|
* // {
|
|
24476
24477
|
* // _id: 'Exit',
|
|
24477
24478
|
* // _tag: 'Failure',
|
|
24478
|
-
* // cause: { _id: 'Cause', _tag: 'Fail',
|
|
24479
|
+
* // cause: { _id: 'Cause', _tag: 'Fail', error: 'invalid age' }
|
|
24479
24480
|
* // }
|
|
24480
24481
|
* ```
|
|
24481
24482
|
*
|
|
@@ -24525,7 +24526,7 @@ export const orElseFail: {
|
|
|
24525
24526
|
* // {
|
|
24526
24527
|
* // _id: 'Exit',
|
|
24527
24528
|
* // _tag: 'Failure',
|
|
24528
|
-
* // cause: { _id: 'Cause', _tag: 'Fail',
|
|
24529
|
+
* // cause: { _id: 'Cause', _tag: 'Fail', error: 'invalid age' }
|
|
24529
24530
|
* // }
|
|
24530
24531
|
* ```
|
|
24531
24532
|
*
|
|
@@ -25558,7 +25559,7 @@ export const runPromise: <A, E>(
|
|
|
25558
25559
|
* // cause: {
|
|
25559
25560
|
* // _id: "Cause",
|
|
25560
25561
|
* // _tag: "Fail",
|
|
25561
|
-
* //
|
|
25562
|
+
* // error: "my error"
|
|
25562
25563
|
* // }
|
|
25563
25564
|
* // }
|
|
25564
25565
|
* ```
|
|
@@ -25696,7 +25697,7 @@ export const runSync: <A, E>(effect: Effect<A, E>) => A = runtime_.unsafeRunSync
|
|
|
25696
25697
|
* // cause: {
|
|
25697
25698
|
* // _id: "Cause",
|
|
25698
25699
|
* // _tag: "Fail",
|
|
25699
|
-
* //
|
|
25700
|
+
* // error: "my error"
|
|
25700
25701
|
* // }
|
|
25701
25702
|
* // }
|
|
25702
25703
|
* ```
|
|
@@ -25769,8 +25770,8 @@ export const runSyncExit: <A, E>(effect: Effect<A, E>) => Exit.Exit<A, E> = runt
|
|
|
25769
25770
|
* // cause: {
|
|
25770
25771
|
* // _id: 'Cause',
|
|
25771
25772
|
* // _tag: 'Sequential',
|
|
25772
|
-
* // left: { _id: 'Cause', _tag: 'Fail',
|
|
25773
|
-
* // right: { _id: 'Cause', _tag: 'Fail',
|
|
25773
|
+
* // left: { _id: 'Cause', _tag: 'Fail', error: 'Oh uh!' },
|
|
25774
|
+
* // right: { _id: 'Cause', _tag: 'Fail', error: 'Oh no!' }
|
|
25774
25775
|
* // }
|
|
25775
25776
|
* // }
|
|
25776
25777
|
* ```
|
|
@@ -25822,8 +25823,8 @@ export const validate: {
|
|
|
25822
25823
|
* // cause: {
|
|
25823
25824
|
* // _id: 'Cause',
|
|
25824
25825
|
* // _tag: 'Sequential',
|
|
25825
|
-
* // left: { _id: 'Cause', _tag: 'Fail',
|
|
25826
|
-
* // right: { _id: 'Cause', _tag: 'Fail',
|
|
25826
|
+
* // left: { _id: 'Cause', _tag: 'Fail', error: 'Oh uh!' },
|
|
25827
|
+
* // right: { _id: 'Cause', _tag: 'Fail', error: 'Oh no!' }
|
|
25827
25828
|
* // }
|
|
25828
25829
|
* // }
|
|
25829
25830
|
* ```
|
|
@@ -25882,8 +25883,8 @@ export const validate: {
|
|
|
25882
25883
|
* // cause: {
|
|
25883
25884
|
* // _id: 'Cause',
|
|
25884
25885
|
* // _tag: 'Sequential',
|
|
25885
|
-
* // left: { _id: 'Cause', _tag: 'Fail',
|
|
25886
|
-
* // right: { _id: 'Cause', _tag: 'Fail',
|
|
25886
|
+
* // left: { _id: 'Cause', _tag: 'Fail', error: 'Oh uh!' },
|
|
25887
|
+
* // right: { _id: 'Cause', _tag: 'Fail', error: 'Oh no!' }
|
|
25887
25888
|
* // }
|
|
25888
25889
|
* // }
|
|
25889
25890
|
* ```
|
|
@@ -27466,7 +27467,7 @@ export const withParentSpan: {
|
|
|
27466
27467
|
* // cause: {
|
|
27467
27468
|
* // _id: 'Cause',
|
|
27468
27469
|
* // _tag: 'Fail',
|
|
27469
|
-
* //
|
|
27470
|
+
* // error: { _tag: 'NoSuchElementException' }
|
|
27470
27471
|
* // }
|
|
27471
27472
|
* // }
|
|
27472
27473
|
* ```
|
|
@@ -27807,10 +27808,10 @@ export const Tag: <const Id extends string>(id: Id) => <
|
|
|
27807
27808
|
: [X] extends [PromiseLike<infer A>] ? Effect<A, Cause.UnknownException, Self>
|
|
27808
27809
|
: Effect<X, never, Self>
|
|
27809
27810
|
} = (id) => () => {
|
|
27810
|
-
const limit =
|
|
27811
|
-
|
|
27811
|
+
const limit = getStackTraceLimit()
|
|
27812
|
+
setStackTraceLimit(2)
|
|
27812
27813
|
const creationError = new Error()
|
|
27813
|
-
|
|
27814
|
+
setStackTraceLimit(limit)
|
|
27814
27815
|
function TagClass() {}
|
|
27815
27816
|
Object.setPrototypeOf(TagClass, TagProto)
|
|
27816
27817
|
TagClass.key = id
|
|
@@ -27966,10 +27967,10 @@ export const Service: <Self = never>() => [Self] extends [never] ? MissingSelfGe
|
|
|
27966
27967
|
return function() {
|
|
27967
27968
|
const [id, maker] = arguments
|
|
27968
27969
|
const proxy = "accessors" in maker ? maker["accessors"] : false
|
|
27969
|
-
const limit =
|
|
27970
|
-
|
|
27970
|
+
const limit = getStackTraceLimit()
|
|
27971
|
+
setStackTraceLimit(2)
|
|
27971
27972
|
const creationError = new Error()
|
|
27972
|
-
|
|
27973
|
+
setStackTraceLimit(limit)
|
|
27973
27974
|
|
|
27974
27975
|
let patchState: "unchecked" | "plain" | "patched" = "unchecked"
|
|
27975
27976
|
const TagClass: any = function(this: any, service: any) {
|
|
@@ -28926,16 +28927,16 @@ export const fn:
|
|
|
28926
28927
|
name: string,
|
|
28927
28928
|
options?: Tracer.SpanOptions
|
|
28928
28929
|
) => fn.Gen & fn.NonGen) = function(nameOrBody: Function | string, ...pipeables: Array<any>) {
|
|
28929
|
-
const limit =
|
|
28930
|
-
|
|
28930
|
+
const limit = getStackTraceLimit()
|
|
28931
|
+
setStackTraceLimit(2)
|
|
28931
28932
|
const errorDef = new Error()
|
|
28932
|
-
|
|
28933
|
+
setStackTraceLimit(limit)
|
|
28933
28934
|
if (typeof nameOrBody !== "string") {
|
|
28934
28935
|
return defineLength(nameOrBody.length, function(this: any, ...args: Array<any>) {
|
|
28935
|
-
const limit =
|
|
28936
|
-
|
|
28936
|
+
const limit = getStackTraceLimit()
|
|
28937
|
+
setStackTraceLimit(2)
|
|
28937
28938
|
const errorCall = new Error()
|
|
28938
|
-
|
|
28939
|
+
setStackTraceLimit(limit)
|
|
28939
28940
|
return fnApply({
|
|
28940
28941
|
self: this,
|
|
28941
28942
|
body: nameOrBody,
|
|
@@ -28957,10 +28958,10 @@ export const fn:
|
|
|
28957
28958
|
body.length,
|
|
28958
28959
|
({
|
|
28959
28960
|
[name](this: any, ...args: Array<any>) {
|
|
28960
|
-
const limit =
|
|
28961
|
-
|
|
28961
|
+
const limit = getStackTraceLimit()
|
|
28962
|
+
setStackTraceLimit(2)
|
|
28962
28963
|
const errorCall = new Error()
|
|
28963
|
-
|
|
28964
|
+
setStackTraceLimit(limit)
|
|
28964
28965
|
return fnApply({
|
|
28965
28966
|
self: this,
|
|
28966
28967
|
body,
|
|
@@ -28999,7 +29000,20 @@ function fnApply(options: {
|
|
|
28999
29000
|
effect = core.fromIterator(() => options.body.apply(options.self, options.args))
|
|
29000
29001
|
} else {
|
|
29001
29002
|
try {
|
|
29002
|
-
|
|
29003
|
+
const result = options.body.apply(options.self, options.args)
|
|
29004
|
+
if (core.isEffect(result)) {
|
|
29005
|
+
effect = result
|
|
29006
|
+
} else {
|
|
29007
|
+
// transpiled generator bodies return an iterator; reuse it for the first run
|
|
29008
|
+
let first = true
|
|
29009
|
+
effect = core.fromIterator(() => {
|
|
29010
|
+
if (first) {
|
|
29011
|
+
first = false
|
|
29012
|
+
return result
|
|
29013
|
+
}
|
|
29014
|
+
return options.body.apply(options.self, options.args)
|
|
29015
|
+
})
|
|
29016
|
+
}
|
|
29003
29017
|
} catch (error) {
|
|
29004
29018
|
fnError = error
|
|
29005
29019
|
effect = die(error)
|
package/src/LayerMap.ts
CHANGED
|
@@ -8,6 +8,7 @@ import * as Effect from "./Effect.js"
|
|
|
8
8
|
import * as FiberRefsPatch from "./FiberRefsPatch.js"
|
|
9
9
|
import { identity } from "./Function.js"
|
|
10
10
|
import * as core from "./internal/core.js"
|
|
11
|
+
import { getStackTraceLimit, setStackTraceLimit } from "./internal/stackTraceLimit.js"
|
|
11
12
|
import * as Layer from "./Layer.js"
|
|
12
13
|
import * as RcMap from "./RcMap.js"
|
|
13
14
|
import * as Runtime from "./Runtime.js"
|
|
@@ -381,10 +382,10 @@ export const Service = <Self>() =>
|
|
|
381
382
|
Options extends { readonly dependencies: ReadonlyArray<any> } ? Options["dependencies"][number] : never
|
|
382
383
|
> => {
|
|
383
384
|
const Err = globalThis.Error as any
|
|
384
|
-
const limit =
|
|
385
|
-
|
|
385
|
+
const limit = getStackTraceLimit()
|
|
386
|
+
setStackTraceLimit(2)
|
|
386
387
|
const creationError = new Err()
|
|
387
|
-
|
|
388
|
+
setStackTraceLimit(limit)
|
|
388
389
|
|
|
389
390
|
function TagClass() {}
|
|
390
391
|
const TagClass_ = TagClass as any as Mutable<TagClass<Self, Id, string, any, any, any, any, any>>
|
package/src/Micro.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { format, NodeInspectSymbol, toStringUnknown } from "./Inspectable.js"
|
|
|
21
21
|
import * as InternalContext from "./internal/context.js"
|
|
22
22
|
import * as doNotation from "./internal/doNotation.js"
|
|
23
23
|
import { StructuralPrototype } from "./internal/effectable.js"
|
|
24
|
+
import { getStackTraceLimit, setStackTraceLimit } from "./internal/stackTraceLimit.js"
|
|
24
25
|
import * as Option from "./Option.js"
|
|
25
26
|
import type { Pipeable } from "./Pipeable.js"
|
|
26
27
|
import { pipeArguments } from "./Pipeable.js"
|
|
@@ -3831,10 +3832,10 @@ export const withTrace: {
|
|
|
3831
3832
|
*/
|
|
3832
3833
|
<A, E, R>(self: Micro<A, E, R>, name: string): Micro<A, E, R>
|
|
3833
3834
|
} = function() {
|
|
3834
|
-
const prevLimit =
|
|
3835
|
-
|
|
3835
|
+
const prevLimit = getStackTraceLimit()
|
|
3836
|
+
setStackTraceLimit(2)
|
|
3836
3837
|
const error = new globalThis.Error()
|
|
3837
|
-
|
|
3838
|
+
setStackTraceLimit(prevLimit)
|
|
3838
3839
|
function generate(name: string, cause: MicroCause<any>) {
|
|
3839
3840
|
const stack = error.stack
|
|
3840
3841
|
if (!stack) {
|
package/src/Stream.ts
CHANGED
|
@@ -2638,7 +2638,7 @@ export const execute: <X, E, R>(effect: Effect.Effect<X, E, R>) => Stream<never,
|
|
|
2638
2638
|
* // {
|
|
2639
2639
|
* // _id: 'Exit',
|
|
2640
2640
|
* // _tag: 'Failure',
|
|
2641
|
-
* // cause: { _id: 'Cause', _tag: 'Fail',
|
|
2641
|
+
* // cause: { _id: 'Cause', _tag: 'Fail', error: 'Uh oh!' }
|
|
2642
2642
|
* // }
|
|
2643
2643
|
* ```
|
|
2644
2644
|
*
|
package/src/internal/cause.ts
CHANGED
|
@@ -17,6 +17,7 @@ import type { AnySpan, Span } from "../Tracer.js"
|
|
|
17
17
|
import type * as Types from "../Types.js"
|
|
18
18
|
import { getBugErrorMessage } from "./errors.js"
|
|
19
19
|
import * as OpCodes from "./opCodes/cause.js"
|
|
20
|
+
import { getStackTraceLimit, setStackTraceLimit } from "./stackTraceLimit.js"
|
|
20
21
|
|
|
21
22
|
// -----------------------------------------------------------------------------
|
|
22
23
|
// Models
|
|
@@ -60,7 +61,7 @@ const proto = {
|
|
|
60
61
|
case "Interrupt":
|
|
61
62
|
return { _id: "Cause", _tag: this._tag, fiberId: this.fiberId.toJSON() }
|
|
62
63
|
case "Fail":
|
|
63
|
-
return { _id: "Cause", _tag: this._tag,
|
|
64
|
+
return { _id: "Cause", _tag: this._tag, error: toJSON(this.error) }
|
|
64
65
|
case "Sequential":
|
|
65
66
|
case "Parallel":
|
|
66
67
|
return { _id: "Cause", _tag: this._tag, left: toJSON(this.left), right: toJSON(this.right) }
|
|
@@ -898,19 +899,19 @@ const renderErrorCause = (cause: Cause.PrettyError, prefix: string) => {
|
|
|
898
899
|
/** @internal */
|
|
899
900
|
export const makePrettyError = (originalError: unknown): Cause.PrettyError => {
|
|
900
901
|
const originalErrorIsObject = typeof originalError === "object" && originalError !== null
|
|
901
|
-
const prevLimit =
|
|
902
|
-
|
|
902
|
+
const prevLimit = getStackTraceLimit()
|
|
903
|
+
setStackTraceLimit(1)
|
|
903
904
|
const error = new Error(
|
|
904
905
|
prettyErrorMessage(originalError),
|
|
905
906
|
originalErrorIsObject && "cause" in originalError && typeof originalError.cause !== "undefined"
|
|
906
907
|
? { cause: makePrettyError(originalError.cause) }
|
|
907
908
|
: undefined
|
|
908
909
|
) as Types.Mutable<Cause.PrettyError>
|
|
909
|
-
|
|
910
|
+
setStackTraceLimit(prevLimit)
|
|
910
911
|
if (error.message === "") {
|
|
911
912
|
error.message = "An error has occurred"
|
|
912
913
|
}
|
|
913
|
-
|
|
914
|
+
setStackTraceLimit(prevLimit)
|
|
914
915
|
error.name = originalError instanceof Error ? originalError.name : "Error"
|
|
915
916
|
if (originalErrorIsObject) {
|
|
916
917
|
if (spanSymbol in originalError) {
|
package/src/internal/context.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type * as STM from "../STM.js"
|
|
|
12
12
|
import type { NoInfer } from "../Types.js"
|
|
13
13
|
import { EffectPrototype, effectVariance } from "./effectable.js"
|
|
14
14
|
import * as option from "./option.js"
|
|
15
|
+
import { getStackTraceLimit, setStackTraceLimit } from "./stackTraceLimit.js"
|
|
15
16
|
|
|
16
17
|
/** @internal */
|
|
17
18
|
export const TagTypeId: C.TagTypeId = Symbol.for("effect/Context/Tag") as C.TagTypeId
|
|
@@ -67,10 +68,10 @@ export const ReferenceProto: any = {
|
|
|
67
68
|
|
|
68
69
|
/** @internal */
|
|
69
70
|
export const makeGenericTag = <Identifier, Service = Identifier>(key: string): C.Tag<Identifier, Service> => {
|
|
70
|
-
const limit =
|
|
71
|
-
|
|
71
|
+
const limit = getStackTraceLimit()
|
|
72
|
+
setStackTraceLimit(2)
|
|
72
73
|
const creationError = new Error()
|
|
73
|
-
|
|
74
|
+
setStackTraceLimit(limit)
|
|
74
75
|
const tag = Object.create(TagProto)
|
|
75
76
|
Object.defineProperty(tag, "stack", {
|
|
76
77
|
get() {
|
|
@@ -83,10 +84,10 @@ export const makeGenericTag = <Identifier, Service = Identifier>(key: string): C
|
|
|
83
84
|
|
|
84
85
|
/** @internal */
|
|
85
86
|
export const Tag = <const Id extends string>(id: Id) => <Self, Shape>(): C.TagClass<Self, Id, Shape> => {
|
|
86
|
-
const limit =
|
|
87
|
-
|
|
87
|
+
const limit = getStackTraceLimit()
|
|
88
|
+
setStackTraceLimit(2)
|
|
88
89
|
const creationError = new Error()
|
|
89
|
-
|
|
90
|
+
setStackTraceLimit(limit)
|
|
90
91
|
|
|
91
92
|
function TagClass() {}
|
|
92
93
|
Object.setPrototypeOf(TagClass, TagProto)
|
|
@@ -104,10 +105,10 @@ export const Reference = <Self>() =>
|
|
|
104
105
|
<const Id extends string, Service>(id: Id, options: {
|
|
105
106
|
readonly defaultValue: () => Service
|
|
106
107
|
}): C.ReferenceClass<Self, Id, Service> => {
|
|
107
|
-
const limit =
|
|
108
|
-
|
|
108
|
+
const limit = getStackTraceLimit()
|
|
109
|
+
setStackTraceLimit(2)
|
|
109
110
|
const creationError = new Error()
|
|
110
|
-
|
|
111
|
+
setStackTraceLimit(limit)
|
|
111
112
|
|
|
112
113
|
function ReferenceClass() {}
|
|
113
114
|
Object.setPrototypeOf(ReferenceClass, ReferenceProto)
|
|
@@ -38,6 +38,7 @@ import * as fiberRefsPatch from "./fiberRefs/patch.js"
|
|
|
38
38
|
import type { FiberRuntime } from "./fiberRuntime.js"
|
|
39
39
|
import * as metricLabel from "./metric/label.js"
|
|
40
40
|
import * as runtimeFlags from "./runtimeFlags.js"
|
|
41
|
+
import { getStackTraceLimit, setStackTraceLimit } from "./stackTraceLimit.js"
|
|
41
42
|
import * as internalTracer from "./tracer.js"
|
|
42
43
|
|
|
43
44
|
/* @internal */
|
|
@@ -2252,10 +2253,10 @@ export const functionWithSpan = <Args extends Array<any>, Ret extends Effect.Eff
|
|
|
2252
2253
|
(function(this: any) {
|
|
2253
2254
|
let captureStackTrace: LazyArg<string | undefined> | boolean = options.captureStackTrace ?? false
|
|
2254
2255
|
if (options.captureStackTrace !== false) {
|
|
2255
|
-
const limit =
|
|
2256
|
-
|
|
2256
|
+
const limit = getStackTraceLimit()
|
|
2257
|
+
setStackTraceLimit(2)
|
|
2257
2258
|
const error = new Error()
|
|
2258
|
-
|
|
2259
|
+
setStackTraceLimit(limit)
|
|
2259
2260
|
let cache: false | string = false
|
|
2260
2261
|
captureStackTrace = () => {
|
|
2261
2262
|
if (cache !== false) {
|
|
@@ -279,31 +279,29 @@ const getCachedValue = <A, E, R>(
|
|
|
279
279
|
timeToLive: Duration.DurationInput,
|
|
280
280
|
cache: Synchronized.SynchronizedRef<Option.Option<readonly [number, Deferred.Deferred<A, E>]>>
|
|
281
281
|
): Effect.Effect<A, E, R> =>
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
return Option.some(computeCachedValue(self, timeToLive, time))
|
|
290
|
-
}
|
|
291
|
-
case "Some": {
|
|
292
|
-
const [end] = option.value
|
|
293
|
-
return end - time <= 0
|
|
294
|
-
? Option.some(computeCachedValue(self, timeToLive, time))
|
|
295
|
-
: Option.none()
|
|
296
|
-
}
|
|
282
|
+
pipe(
|
|
283
|
+
effect.clockWith((clock) => clock.currentTimeMillis),
|
|
284
|
+
core.flatMap((time) =>
|
|
285
|
+
updateSomeAndGetEffectSynchronized(cache, (option) => {
|
|
286
|
+
switch (option._tag) {
|
|
287
|
+
case "None": {
|
|
288
|
+
return Option.some(computeCachedValue(self, timeToLive, time))
|
|
297
289
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
290
|
+
case "Some": {
|
|
291
|
+
const [end] = option.value
|
|
292
|
+
return end - time <= 0
|
|
293
|
+
? Option.some(computeCachedValue(self, timeToLive, time))
|
|
294
|
+
: Option.none()
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
})
|
|
298
|
+
),
|
|
299
|
+
core.flatMap((option) =>
|
|
300
|
+
Option.isNone(option) ?
|
|
301
|
+
core.dieMessage(
|
|
302
|
+
"BUG: Effect.cachedInvalidate - please report an issue at https://github.com/Effect-TS/effect/issues"
|
|
303
|
+
) :
|
|
304
|
+
core.deferredAwait(option.value[1])
|
|
307
305
|
)
|
|
308
306
|
)
|
|
309
307
|
|