effect 3.12.7 → 3.12.8
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 +1 -1
- package/dist/cjs/BigDecimal.js.map +1 -1
- package/dist/cjs/Cause.js +630 -167
- package/dist/cjs/Cause.js.map +1 -1
- package/dist/cjs/Chunk.js +4 -8
- package/dist/cjs/Chunk.js.map +1 -1
- package/dist/cjs/ConfigProvider.js +1 -0
- package/dist/cjs/ConfigProvider.js.map +1 -1
- package/dist/cjs/Cron.js +26 -10
- package/dist/cjs/Cron.js.map +1 -1
- package/dist/cjs/Duration.js +7 -4
- package/dist/cjs/Duration.js.map +1 -1
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/Either.js +5 -24
- package/dist/cjs/Either.js.map +1 -1
- package/dist/cjs/Layer.js.map +1 -1
- package/dist/cjs/Option.js +1042 -363
- package/dist/cjs/Option.js.map +1 -1
- package/dist/cjs/ParseResult.js +41 -18
- package/dist/cjs/ParseResult.js.map +1 -1
- package/dist/cjs/Schedule.js +8 -1
- package/dist/cjs/Schedule.js.map +1 -1
- package/dist/cjs/Schema.js +51 -10
- package/dist/cjs/Schema.js.map +1 -1
- package/dist/cjs/internal/cause.js +23 -108
- package/dist/cjs/internal/cause.js.map +1 -1
- package/dist/cjs/internal/core.js +4 -5
- package/dist/cjs/internal/core.js.map +1 -1
- package/dist/cjs/internal/layer.js.map +1 -1
- package/dist/cjs/internal/schedule.js.map +1 -1
- package/dist/cjs/internal/secret.js +6 -5
- package/dist/cjs/internal/secret.js.map +1 -1
- package/dist/cjs/internal/stream.js +21 -23
- package/dist/cjs/internal/stream.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/BigDecimal.d.ts.map +1 -1
- package/dist/dts/Cause.d.ts +1157 -304
- package/dist/dts/Cause.d.ts.map +1 -1
- package/dist/dts/Chunk.d.ts +3 -6
- package/dist/dts/Chunk.d.ts.map +1 -1
- package/dist/dts/ConfigProvider.d.ts.map +1 -1
- package/dist/dts/Cron.d.ts +25 -9
- package/dist/dts/Cron.d.ts.map +1 -1
- package/dist/dts/Duration.d.ts +1 -1
- package/dist/dts/Duration.d.ts.map +1 -1
- package/dist/dts/Effect.d.ts +3 -2
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/Either.d.ts.map +1 -1
- package/dist/dts/Layer.d.ts +1 -1
- package/dist/dts/Layer.d.ts.map +1 -1
- package/dist/dts/Option.d.ts +2288 -784
- package/dist/dts/Option.d.ts.map +1 -1
- package/dist/dts/ParseResult.d.ts +4 -4
- package/dist/dts/ParseResult.d.ts.map +1 -1
- package/dist/dts/Schedule.d.ts +7 -0
- package/dist/dts/Schedule.d.ts.map +1 -1
- package/dist/dts/Schema.d.ts +15 -4
- package/dist/dts/Schema.d.ts.map +1 -1
- package/dist/dts/internal/core.d.ts.map +1 -1
- package/dist/dts/internal/stream.d.ts +1 -1
- package/dist/dts/internal/stream.d.ts.map +1 -1
- package/dist/esm/BigDecimal.js +1 -1
- package/dist/esm/BigDecimal.js.map +1 -1
- package/dist/esm/Cause.js +630 -167
- package/dist/esm/Cause.js.map +1 -1
- package/dist/esm/Chunk.js +4 -8
- package/dist/esm/Chunk.js.map +1 -1
- package/dist/esm/ConfigProvider.js +1 -0
- package/dist/esm/ConfigProvider.js.map +1 -1
- package/dist/esm/Cron.js +27 -11
- package/dist/esm/Cron.js.map +1 -1
- package/dist/esm/Duration.js +7 -4
- package/dist/esm/Duration.js.map +1 -1
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/Either.js +5 -24
- package/dist/esm/Either.js.map +1 -1
- package/dist/esm/Layer.js.map +1 -1
- package/dist/esm/Option.js +1041 -363
- package/dist/esm/Option.js.map +1 -1
- package/dist/esm/ParseResult.js +41 -18
- package/dist/esm/ParseResult.js.map +1 -1
- package/dist/esm/Schedule.js +7 -0
- package/dist/esm/Schedule.js.map +1 -1
- package/dist/esm/Schema.js +51 -10
- package/dist/esm/Schema.js.map +1 -1
- package/dist/esm/internal/cause.js +22 -108
- package/dist/esm/internal/cause.js.map +1 -1
- package/dist/esm/internal/core.js +4 -5
- package/dist/esm/internal/core.js.map +1 -1
- package/dist/esm/internal/layer.js.map +1 -1
- package/dist/esm/internal/schedule.js.map +1 -1
- package/dist/esm/internal/secret.js +5 -4
- package/dist/esm/internal/secret.js.map +1 -1
- package/dist/esm/internal/stream.js +21 -23
- package/dist/esm/internal/stream.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/BigDecimal.ts +1 -1
- package/src/Cause.ts +1158 -304
- package/src/Chunk.ts +8 -11
- package/src/ConfigProvider.ts +1 -0
- package/src/Cron.ts +28 -11
- package/src/Duration.ts +10 -5
- package/src/Effect.ts +5 -2
- package/src/Either.ts +11 -28
- package/src/Layer.ts +1 -1
- package/src/Option.ts +2314 -820
- package/src/ParseResult.ts +53 -29
- package/src/Schedule.ts +8 -0
- package/src/Schema.ts +68 -12
- package/src/internal/cause.ts +38 -137
- package/src/internal/core.ts +4 -5
- package/src/internal/layer.ts +1 -1
- package/src/internal/schedule.ts +7 -6
- package/src/internal/secret.ts +6 -4
- package/src/internal/stream.ts +24 -37
- package/src/internal/version.ts +1 -1
package/dist/esm/Cause.js
CHANGED
|
@@ -1,456 +1,889 @@
|
|
|
1
1
|
import * as internal from "./internal/cause.js";
|
|
2
2
|
import * as core from "./internal/core.js";
|
|
3
3
|
/**
|
|
4
|
+
* A unique symbol identifying the `Cause` type.
|
|
5
|
+
*
|
|
6
|
+
* **Details**
|
|
7
|
+
*
|
|
8
|
+
* This provides a symbol that helps identify instances of the `Cause` data
|
|
9
|
+
* type. This can be used for advanced operations such as refining types or
|
|
10
|
+
* building internal utilities that check whether an unknown value is a `Cause`.
|
|
11
|
+
*
|
|
12
|
+
* @see {@link isCause} Check if a value is a `Cause`
|
|
4
13
|
* @since 2.0.0
|
|
5
|
-
* @category
|
|
14
|
+
* @category Symbols
|
|
6
15
|
*/
|
|
7
16
|
export const CauseTypeId = internal.CauseTypeId;
|
|
8
17
|
/**
|
|
18
|
+
* A unique symbol identifying the `RuntimeException` type.
|
|
19
|
+
*
|
|
20
|
+
* **Details**
|
|
21
|
+
*
|
|
22
|
+
* This provides a symbol that identifies a `RuntimeException`. This is
|
|
23
|
+
* typically used internally by the library to recognize checked exceptions that
|
|
24
|
+
* occur during runtime.
|
|
25
|
+
*
|
|
26
|
+
* @see {@link RuntimeException} Create or work with a `RuntimeException`
|
|
27
|
+
*
|
|
9
28
|
* @since 2.0.0
|
|
10
|
-
* @category
|
|
29
|
+
* @category Symbols
|
|
11
30
|
*/
|
|
12
31
|
export const RuntimeExceptionTypeId = core.RuntimeExceptionTypeId;
|
|
13
32
|
/**
|
|
33
|
+
* A unique symbol identifying the `InterruptedException` type.
|
|
34
|
+
*
|
|
35
|
+
* **Details**
|
|
36
|
+
*
|
|
37
|
+
* This provides a symbol that identifies an `InterruptedException`. This is
|
|
38
|
+
* typically used internally to recognize when a fiber has been interrupted,
|
|
39
|
+
* helping the framework handle interruption logic correctly.
|
|
40
|
+
*
|
|
41
|
+
* @see {@link InterruptedException} Create or work with an `InterruptedException`
|
|
42
|
+
*
|
|
14
43
|
* @since 2.0.0
|
|
15
|
-
* @category
|
|
44
|
+
* @category Symbols
|
|
16
45
|
*/
|
|
17
46
|
export const InterruptedExceptionTypeId = core.InterruptedExceptionTypeId;
|
|
18
47
|
/**
|
|
48
|
+
* A unique symbol identifying the `IllegalArgumentException` type.
|
|
49
|
+
*
|
|
50
|
+
* **Details**
|
|
51
|
+
*
|
|
52
|
+
* This provides a symbol that identifies an `IllegalArgumentException`. This is
|
|
53
|
+
* often used in scenarios where invalid arguments are supplied to methods that
|
|
54
|
+
* expect specific input.
|
|
55
|
+
*
|
|
56
|
+
* @see {@link IllegalArgumentException} Create or work with an `IllegalArgumentException`
|
|
57
|
+
*
|
|
19
58
|
* @since 2.0.0
|
|
20
|
-
* @category
|
|
59
|
+
* @category Symbols
|
|
21
60
|
*/
|
|
22
61
|
export const IllegalArgumentExceptionTypeId = core.IllegalArgumentExceptionTypeId;
|
|
23
62
|
/**
|
|
63
|
+
* A unique symbol identifying the `NoSuchElementException` type.
|
|
64
|
+
*
|
|
65
|
+
* **Details**
|
|
66
|
+
*
|
|
67
|
+
* This provides a symbol that identifies a `NoSuchElementException`. It helps
|
|
68
|
+
* differentiate cases where a required element is missing within a data
|
|
69
|
+
* structure.
|
|
70
|
+
*
|
|
71
|
+
* @see {@link NoSuchElementException} Create or work with a `NoSuchElementException`
|
|
72
|
+
*
|
|
24
73
|
* @since 2.0.0
|
|
25
|
-
* @category
|
|
74
|
+
* @category Symbols
|
|
26
75
|
*/
|
|
27
76
|
export const NoSuchElementExceptionTypeId = core.NoSuchElementExceptionTypeId;
|
|
28
77
|
/**
|
|
78
|
+
* A unique symbol identifying the `InvalidPubSubCapacityException` type.
|
|
79
|
+
*
|
|
80
|
+
* **Details**
|
|
81
|
+
*
|
|
82
|
+
* This provides a symbol that identifies an `InvalidPubSubCapacityException`.
|
|
83
|
+
* It indicates an error related to an invalid capacity passed to a `PubSub`
|
|
84
|
+
* structure.
|
|
85
|
+
*
|
|
86
|
+
* @see {@link InvalidPubSubCapacityException} Create or work with an `InvalidPubSubCapacityException`
|
|
87
|
+
*
|
|
29
88
|
* @since 2.0.0
|
|
30
|
-
* @category
|
|
89
|
+
* @category Symbols
|
|
31
90
|
*/
|
|
32
91
|
export const InvalidPubSubCapacityExceptionTypeId = core.InvalidPubSubCapacityExceptionTypeId;
|
|
33
92
|
/**
|
|
93
|
+
* A unique symbol identifying the `ExceededCapacityException` type.
|
|
94
|
+
*
|
|
95
|
+
* **Details**
|
|
96
|
+
*
|
|
97
|
+
* This provides a symbol that identifies an `ExceededCapacityException`. It
|
|
98
|
+
* denotes situations where a resource has exceeded its configured capacity
|
|
99
|
+
* limit.
|
|
100
|
+
*
|
|
101
|
+
* @see {@link ExceededCapacityException} Create or work with an `ExceededCapacityException`
|
|
102
|
+
*
|
|
34
103
|
* @since 3.5.0
|
|
35
|
-
* @category
|
|
104
|
+
* @category Symbols
|
|
36
105
|
*/
|
|
37
106
|
export const ExceededCapacityExceptionTypeId = core.ExceededCapacityExceptionTypeId;
|
|
38
107
|
/**
|
|
108
|
+
* A unique symbol identifying the `TimeoutException` type.
|
|
109
|
+
*
|
|
110
|
+
* **Details**
|
|
111
|
+
*
|
|
112
|
+
* This provides a symbol that identifies a `TimeoutException`. It helps the
|
|
113
|
+
* framework recognize errors related to operations that fail to complete within
|
|
114
|
+
* a given timeframe.
|
|
115
|
+
*
|
|
116
|
+
* @see {@link TimeoutException} Create or work with a `TimeoutException`
|
|
117
|
+
*
|
|
39
118
|
* @since 2.0.0
|
|
40
|
-
* @category
|
|
119
|
+
* @category Symbols
|
|
41
120
|
*/
|
|
42
121
|
export const TimeoutExceptionTypeId = core.TimeoutExceptionTypeId;
|
|
43
122
|
/**
|
|
123
|
+
* A unique symbol identifying the `UnknownException` type.
|
|
124
|
+
*
|
|
125
|
+
* **Details**
|
|
126
|
+
*
|
|
127
|
+
* This provides a symbol that identifies an `UnknownException`. It is typically
|
|
128
|
+
* used for generic or unexpected errors that do not fit other specific
|
|
129
|
+
* exception categories.
|
|
130
|
+
*
|
|
131
|
+
* @see {@link UnknownException} Create or work with an `UnknownException`
|
|
132
|
+
*
|
|
44
133
|
* @since 2.0.0
|
|
45
|
-
* @category
|
|
134
|
+
* @category Symbols
|
|
46
135
|
*/
|
|
47
136
|
export const UnknownExceptionTypeId = core.UnknownExceptionTypeId;
|
|
48
137
|
/**
|
|
49
|
-
*
|
|
138
|
+
* Creates an error that occurs at runtime, extendable for other exception
|
|
139
|
+
* types.
|
|
50
140
|
*
|
|
51
141
|
* @since 2.0.0
|
|
52
|
-
* @category
|
|
142
|
+
* @category Errors
|
|
53
143
|
*/
|
|
54
144
|
export const YieldableError = core.YieldableError;
|
|
55
145
|
/**
|
|
56
|
-
*
|
|
146
|
+
* Creates an `Empty` cause.
|
|
147
|
+
*
|
|
148
|
+
* **Details**
|
|
149
|
+
*
|
|
150
|
+
* This function returns a cause that signifies "no error." It's commonly used
|
|
151
|
+
* to represent an absence of failure conditions.
|
|
152
|
+
*
|
|
153
|
+
* @see {@link isEmpty} Check if a `Cause` is empty
|
|
57
154
|
*
|
|
58
155
|
* @since 2.0.0
|
|
59
|
-
* @category
|
|
156
|
+
* @category Constructors
|
|
60
157
|
*/
|
|
61
158
|
export const empty = internal.empty;
|
|
62
159
|
/**
|
|
63
|
-
*
|
|
160
|
+
* Creates a `Fail` cause from an expected error.
|
|
161
|
+
*
|
|
162
|
+
* **Details**
|
|
163
|
+
*
|
|
164
|
+
* This function constructs a `Cause` carrying an error of type `E`. It's used
|
|
165
|
+
* when you want to represent a known or anticipated failure in your effectful
|
|
166
|
+
* computations.
|
|
167
|
+
*
|
|
168
|
+
* @see {@link isFailure} Check if a `Cause` contains a failure
|
|
64
169
|
*
|
|
65
170
|
* @since 2.0.0
|
|
66
|
-
* @category
|
|
171
|
+
* @category Constructors
|
|
67
172
|
*/
|
|
68
173
|
export const fail = internal.fail;
|
|
69
174
|
/**
|
|
70
|
-
*
|
|
175
|
+
* Creates a `Die` cause from an unexpected error.
|
|
176
|
+
*
|
|
177
|
+
* **Details**
|
|
178
|
+
*
|
|
179
|
+
* This function wraps an unhandled or unknown defect (like a runtime crash)
|
|
180
|
+
* into a `Cause`. It's useful for capturing unforeseen issues in a structured
|
|
181
|
+
* way.
|
|
182
|
+
*
|
|
183
|
+
* @see {@link isDie} Check if a `Cause` contains a defect
|
|
71
184
|
*
|
|
72
185
|
* @since 2.0.0
|
|
73
|
-
* @category
|
|
186
|
+
* @category Constructors
|
|
74
187
|
*/
|
|
75
188
|
export const die = internal.die;
|
|
76
189
|
/**
|
|
77
|
-
*
|
|
190
|
+
* Creates an `Interrupt` cause from a `FiberId`.
|
|
191
|
+
*
|
|
192
|
+
* **Details**
|
|
193
|
+
*
|
|
194
|
+
* This function represents a fiber that has been interrupted. It stores the
|
|
195
|
+
* identifier of the interrupted fiber, enabling precise tracking of concurrent
|
|
196
|
+
* cancellations.
|
|
197
|
+
*
|
|
198
|
+
* @see {@link isInterrupted} Check if a `Cause` contains an interruption
|
|
78
199
|
*
|
|
79
200
|
* @since 2.0.0
|
|
80
|
-
* @category
|
|
201
|
+
* @category Constructors
|
|
81
202
|
*/
|
|
82
203
|
export const interrupt = internal.interrupt;
|
|
83
204
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
205
|
+
* Combines two `Cause`s in parallel.
|
|
206
|
+
*
|
|
207
|
+
* **Details**
|
|
208
|
+
*
|
|
209
|
+
* This function merges two errors that occurred simultaneously. Instead of
|
|
210
|
+
* discarding one error, both are retained, allowing for richer error reporting
|
|
211
|
+
* and debugging.
|
|
212
|
+
*
|
|
213
|
+
* @see {@link isParallelType} Check if a `Cause` is a `Parallel`
|
|
86
214
|
*
|
|
87
215
|
* @since 2.0.0
|
|
88
|
-
* @category
|
|
216
|
+
* @category Constructors
|
|
89
217
|
*/
|
|
90
218
|
export const parallel = internal.parallel;
|
|
91
219
|
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
220
|
+
* Combines two `Cause`s sequentially.
|
|
221
|
+
*
|
|
222
|
+
* **Details**
|
|
223
|
+
*
|
|
224
|
+
* This function merges two errors that occurred in sequence, such as a main
|
|
225
|
+
* error followed by a finalization error. It preserves both errors for complete
|
|
226
|
+
* failure information.
|
|
227
|
+
*
|
|
228
|
+
* @see {@link isSequentialType} Check if a `Cause` is a `Sequential`
|
|
94
229
|
*
|
|
95
230
|
* @since 2.0.0
|
|
96
|
-
* @category
|
|
231
|
+
* @category Constructors
|
|
97
232
|
*/
|
|
98
233
|
export const sequential = internal.sequential;
|
|
99
234
|
/**
|
|
100
|
-
*
|
|
235
|
+
* Checks if a value is a `Cause`.
|
|
101
236
|
*
|
|
102
237
|
* @since 2.0.0
|
|
103
|
-
* @category
|
|
238
|
+
* @category Guards
|
|
104
239
|
*/
|
|
105
240
|
export const isCause = internal.isCause;
|
|
106
241
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
242
|
+
* Checks if a `Cause` is an `Empty` type.
|
|
243
|
+
*
|
|
244
|
+
* @see {@link empty} Create a new `Empty` cause
|
|
109
245
|
*
|
|
110
246
|
* @since 2.0.0
|
|
111
|
-
* @category
|
|
247
|
+
* @category Guards
|
|
112
248
|
*/
|
|
113
249
|
export const isEmptyType = internal.isEmptyType;
|
|
114
250
|
/**
|
|
115
|
-
*
|
|
116
|
-
*
|
|
251
|
+
* Checks if a `Cause` is a `Fail` type.
|
|
252
|
+
*
|
|
253
|
+
* @see {@link fail} Create a new `Fail` cause
|
|
117
254
|
*
|
|
118
255
|
* @since 2.0.0
|
|
119
|
-
* @category
|
|
256
|
+
* @category Guards
|
|
120
257
|
*/
|
|
121
258
|
export const isFailType = internal.isFailType;
|
|
122
259
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
260
|
+
* Checks if a `Cause` is a `Die` type.
|
|
261
|
+
*
|
|
262
|
+
* @see {@link die} Create a new `Die` cause
|
|
125
263
|
*
|
|
126
264
|
* @since 2.0.0
|
|
127
|
-
* @category
|
|
265
|
+
* @category Guards
|
|
128
266
|
*/
|
|
129
267
|
export const isDieType = internal.isDieType;
|
|
130
268
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
269
|
+
* Checks if a `Cause` is an `Interrupt` type.
|
|
270
|
+
*
|
|
271
|
+
* @see {@link interrupt} Create an `Interrupt` cause
|
|
133
272
|
*
|
|
134
273
|
* @since 2.0.0
|
|
135
|
-
* @category
|
|
274
|
+
* @category Guards
|
|
136
275
|
*/
|
|
137
276
|
export const isInterruptType = internal.isInterruptType;
|
|
138
277
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
278
|
+
* Checks if a `Cause` is a `Sequential` type.
|
|
279
|
+
*
|
|
280
|
+
* @see {@link sequential} Combine two `Cause`s sequentially
|
|
141
281
|
*
|
|
142
282
|
* @since 2.0.0
|
|
143
|
-
* @category
|
|
283
|
+
* @category Guards
|
|
144
284
|
*/
|
|
145
285
|
export const isSequentialType = internal.isSequentialType;
|
|
146
286
|
/**
|
|
147
|
-
*
|
|
148
|
-
*
|
|
287
|
+
* Checks if a `Cause` is a `Parallel` type.
|
|
288
|
+
*
|
|
289
|
+
* @see {@link parallel} Combine two `Cause`s in parallel
|
|
149
290
|
*
|
|
150
291
|
* @since 2.0.0
|
|
151
|
-
* @category
|
|
292
|
+
* @category Guards
|
|
152
293
|
*/
|
|
153
294
|
export const isParallelType = internal.isParallelType;
|
|
154
295
|
/**
|
|
155
|
-
*
|
|
156
|
-
*
|
|
296
|
+
* Calculates the size of a `Cause`.
|
|
297
|
+
*
|
|
298
|
+
* **Details**
|
|
299
|
+
*
|
|
300
|
+
* This function returns the total number of `Cause` nodes in the semiring
|
|
301
|
+
* structure, reflecting how many individual error elements are recorded.
|
|
157
302
|
*
|
|
158
303
|
* @since 2.0.0
|
|
159
|
-
* @category
|
|
304
|
+
* @category Getters
|
|
160
305
|
*/
|
|
161
306
|
export const size = internal.size;
|
|
162
307
|
/**
|
|
163
|
-
*
|
|
308
|
+
* Checks if a `Cause` is entirely empty.
|
|
309
|
+
*
|
|
310
|
+
* **Details**
|
|
311
|
+
*
|
|
312
|
+
* This function returns `true` if the `Cause` contains no errors, defects, or
|
|
313
|
+
* interruptions. It's helpful for verifying if a computation truly had no
|
|
314
|
+
* failures.
|
|
164
315
|
*
|
|
165
316
|
* @since 2.0.0
|
|
166
|
-
* @category
|
|
317
|
+
* @category Getters
|
|
167
318
|
*/
|
|
168
319
|
export const isEmpty = internal.isEmpty;
|
|
169
320
|
/**
|
|
170
|
-
*
|
|
321
|
+
* Checks if a `Cause` contains a failure.
|
|
322
|
+
*
|
|
323
|
+
* **Details**
|
|
324
|
+
*
|
|
325
|
+
* This function returns `true` if the `Cause` includes any `Fail` error. It's
|
|
326
|
+
* commonly used to confirm whether a workflow encountered an anticipated error
|
|
327
|
+
* versus just defects or interruptions.
|
|
171
328
|
*
|
|
172
329
|
* @since 2.0.0
|
|
173
|
-
* @category
|
|
330
|
+
* @category Getters
|
|
174
331
|
*/
|
|
175
332
|
export const isFailure = internal.isFailure;
|
|
176
333
|
/**
|
|
177
|
-
*
|
|
334
|
+
* Checks if a `Cause` contains a defect.
|
|
335
|
+
*
|
|
336
|
+
* **Details**
|
|
337
|
+
*
|
|
338
|
+
* This function returns `true` if the `Cause` includes any unexpected or
|
|
339
|
+
* unhandled errors (`Die`). It's useful for differentiating known failures from
|
|
340
|
+
* unexpected ones.
|
|
178
341
|
*
|
|
179
342
|
* @since 2.0.0
|
|
180
|
-
* @category
|
|
343
|
+
* @category Getters
|
|
181
344
|
*/
|
|
182
345
|
export const isDie = internal.isDie;
|
|
183
346
|
/**
|
|
184
|
-
*
|
|
185
|
-
*
|
|
347
|
+
* Checks if a `Cause` contains an interruption.
|
|
348
|
+
*
|
|
349
|
+
* **Details**
|
|
350
|
+
*
|
|
351
|
+
* This function returns `true` if the `Cause` includes any fiber interruptions.
|
|
186
352
|
*
|
|
187
353
|
* @since 2.0.0
|
|
188
|
-
* @category
|
|
354
|
+
* @category Getters
|
|
189
355
|
*/
|
|
190
356
|
export const isInterrupted = internal.isInterrupted;
|
|
191
357
|
/**
|
|
192
|
-
*
|
|
193
|
-
*
|
|
358
|
+
* Checks if a `Cause` contains only interruptions.
|
|
359
|
+
*
|
|
360
|
+
* **Details**
|
|
361
|
+
*
|
|
362
|
+
* This function returns `true` if the `Cause` has been interrupted but does not
|
|
363
|
+
* contain any other failures, such as `Fail` or `Die`. It's helpful for
|
|
364
|
+
* verifying purely "cancellation" scenarios.
|
|
194
365
|
*
|
|
195
366
|
* @since 2.0.0
|
|
196
|
-
* @category
|
|
367
|
+
* @category Getters
|
|
197
368
|
*/
|
|
198
369
|
export const isInterruptedOnly = internal.isInterruptedOnly;
|
|
199
370
|
/**
|
|
200
|
-
*
|
|
201
|
-
*
|
|
371
|
+
* Extracts all recoverable errors of type `E` from a `Cause`.
|
|
372
|
+
*
|
|
373
|
+
* **Details**
|
|
374
|
+
*
|
|
375
|
+
* This function returns a chunk of errors, providing a list of all `Fail`
|
|
376
|
+
* values found in the cause. It's useful for collecting all known failures for
|
|
377
|
+
* logging or combined error handling.
|
|
202
378
|
*
|
|
203
379
|
* @since 2.0.0
|
|
204
|
-
* @category
|
|
380
|
+
* @category Getters
|
|
205
381
|
*/
|
|
206
382
|
export const failures = internal.failures;
|
|
207
383
|
/**
|
|
208
|
-
*
|
|
384
|
+
* Extracts all unrecoverable defects from a `Cause`.
|
|
385
|
+
*
|
|
386
|
+
* **Details**
|
|
387
|
+
*
|
|
388
|
+
* This function returns a chunk of values representing unexpected errors
|
|
389
|
+
* (`Die`). It's handy for capturing or logging unanticipated failures that
|
|
390
|
+
* might need special handling, such as bug reports.
|
|
209
391
|
*
|
|
210
392
|
* @since 2.0.0
|
|
211
|
-
* @category
|
|
393
|
+
* @category Getters
|
|
212
394
|
*/
|
|
213
395
|
export const defects = internal.defects;
|
|
214
396
|
/**
|
|
215
|
-
*
|
|
216
|
-
*
|
|
397
|
+
* Collects all `FiberId`s responsible for interrupting a fiber.
|
|
398
|
+
*
|
|
399
|
+
* **Details**
|
|
400
|
+
*
|
|
401
|
+
* This function returns a set of IDs indicating which fibers caused
|
|
402
|
+
* interruptions within this `Cause`. It's useful for debugging concurrency
|
|
403
|
+
* issues or tracing cancellations.
|
|
217
404
|
*
|
|
218
405
|
* @since 2.0.0
|
|
219
|
-
* @category
|
|
406
|
+
* @category Getters
|
|
220
407
|
*/
|
|
221
408
|
export const interruptors = internal.interruptors;
|
|
222
409
|
/**
|
|
223
|
-
*
|
|
224
|
-
*
|
|
410
|
+
* Retrieves the first `Fail` error in a `Cause`, if present.
|
|
411
|
+
*
|
|
412
|
+
* **Details**
|
|
413
|
+
*
|
|
414
|
+
* This function returns an `Option` containing the first recoverable error
|
|
415
|
+
* (`E`) from the cause. It's often used to quickly check if there's a primary
|
|
416
|
+
* error to handle or display.
|
|
225
417
|
*
|
|
226
418
|
* @since 2.0.0
|
|
227
|
-
* @category
|
|
419
|
+
* @category Getters
|
|
228
420
|
*/
|
|
229
421
|
export const failureOption = internal.failureOption;
|
|
230
422
|
/**
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
423
|
+
* Splits a `Cause` into either its first `Fail` error or the rest of the cause
|
|
424
|
+
* (which might only contain `Die` or `Interrupt`).
|
|
425
|
+
*
|
|
426
|
+
* **Details**
|
|
427
|
+
*
|
|
428
|
+
* This function either returns the checked error (`E`) or the remaining
|
|
429
|
+
* `Cause<never>` with defects/interruptions. It helps you decide if there's a
|
|
430
|
+
* recoverable path or if only unhandled issues remain.
|
|
234
431
|
*
|
|
235
432
|
* @since 2.0.0
|
|
236
|
-
* @category
|
|
433
|
+
* @category Getters
|
|
237
434
|
*/
|
|
238
435
|
export const failureOrCause = internal.failureOrCause;
|
|
239
436
|
/**
|
|
240
|
-
*
|
|
241
|
-
*
|
|
437
|
+
* Strips out failures with an error of `None` from a `Cause<Option<E>>`.
|
|
438
|
+
*
|
|
439
|
+
* **Details**
|
|
440
|
+
*
|
|
441
|
+
* This function turns a `Cause<Option<E>>` into an `Option<Cause<E>>`. If the
|
|
442
|
+
* cause only contains failures of `None`, it becomes `None`; otherwise, it
|
|
443
|
+
* returns a `Cause` of the remaining errors. It's helpful when working with
|
|
444
|
+
* optional errors and filtering out certain error paths.
|
|
242
445
|
*
|
|
243
446
|
* @since 2.0.0
|
|
244
|
-
* @category
|
|
447
|
+
* @category Getters
|
|
245
448
|
*/
|
|
246
449
|
export const flipCauseOption = internal.flipCauseOption;
|
|
247
450
|
/**
|
|
248
|
-
*
|
|
249
|
-
*
|
|
451
|
+
* Retrieves the first `Die` defect in a `Cause`, if present.
|
|
452
|
+
*
|
|
453
|
+
* **Details**
|
|
454
|
+
*
|
|
455
|
+
* This function returns an `Option` containing the first unexpected failure
|
|
456
|
+
* (`Die`) discovered. It's helpful for diagnosing the primary defect in a chain
|
|
457
|
+
* of errors.
|
|
250
458
|
*
|
|
251
459
|
* @since 2.0.0
|
|
252
|
-
* @category
|
|
460
|
+
* @category Getters
|
|
253
461
|
*/
|
|
254
462
|
export const dieOption = internal.dieOption;
|
|
255
463
|
/**
|
|
256
|
-
*
|
|
257
|
-
*
|
|
464
|
+
* Retrieves the first `Interrupt` in a `Cause`, if present.
|
|
465
|
+
*
|
|
466
|
+
* **Details**
|
|
467
|
+
*
|
|
468
|
+
* This function returns an `Option` with the first fiber interruption
|
|
469
|
+
* discovered. This is particularly useful for concurrency analysis or debugging
|
|
470
|
+
* cancellations.
|
|
258
471
|
*
|
|
259
472
|
* @since 2.0.0
|
|
260
|
-
* @category
|
|
473
|
+
* @category Getters
|
|
261
474
|
*/
|
|
262
475
|
export const interruptOption = internal.interruptOption;
|
|
263
476
|
/**
|
|
264
|
-
*
|
|
265
|
-
*
|
|
477
|
+
* Removes all `Fail` and `Interrupt` nodes, keeping only defects (`Die`) in a
|
|
478
|
+
* `Cause`.
|
|
479
|
+
*
|
|
480
|
+
* **Details**
|
|
481
|
+
*
|
|
482
|
+
* This function strips a cause of recoverable errors and interruptions, leaving
|
|
483
|
+
* only unexpected failures. If no defects remain, it returns `None`. It's
|
|
484
|
+
* valuable for focusing only on unanticipated problems when both known errors
|
|
485
|
+
* and defects could occur.
|
|
266
486
|
*
|
|
267
487
|
* @since 2.0.0
|
|
268
|
-
* @category
|
|
488
|
+
* @category Getters
|
|
269
489
|
*/
|
|
270
490
|
export const keepDefects = internal.keepDefects;
|
|
491
|
+
// TODO(4.0): remove? what's the point of this API?
|
|
271
492
|
/**
|
|
272
|
-
* Linearizes
|
|
273
|
-
*
|
|
493
|
+
* Linearizes a `Cause` into a set of parallel causes, each containing a
|
|
494
|
+
* sequential chain of failures.
|
|
495
|
+
*
|
|
496
|
+
* **Details**
|
|
497
|
+
*
|
|
498
|
+
* This function reorganizes the cause structure so that you can analyze each
|
|
499
|
+
* parallel branch separately, even if they have multiple sequential errors.
|
|
274
500
|
*
|
|
275
501
|
* @since 2.0.0
|
|
276
|
-
* @category
|
|
502
|
+
* @category Getters
|
|
277
503
|
*/
|
|
278
504
|
export const linearize = internal.linearize;
|
|
279
505
|
/**
|
|
280
|
-
*
|
|
281
|
-
*
|
|
506
|
+
* Removes `Fail` and `Interrupt` nodes from a `Cause`, keeping only defects
|
|
507
|
+
* (`Die`).
|
|
508
|
+
*
|
|
509
|
+
* **Details**
|
|
510
|
+
*
|
|
511
|
+
* This function is similar to `keepDefects` but returns a `Cause<never>`
|
|
512
|
+
* directly, which can still store `Die` or finalizer-related defects. It's
|
|
513
|
+
* helpful for analyzing only the irrecoverable portion of the error.
|
|
282
514
|
*
|
|
283
515
|
* @since 2.0.0
|
|
284
|
-
* @category
|
|
516
|
+
* @category Getters
|
|
285
517
|
*/
|
|
286
518
|
export const stripFailures = internal.stripFailures;
|
|
287
519
|
/**
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
520
|
+
* Removes matching defects from a `Cause` using a partial function, returning
|
|
521
|
+
* the remainder.
|
|
522
|
+
*
|
|
523
|
+
* **Details**
|
|
524
|
+
*
|
|
525
|
+
* This function applies a user-defined extraction function to each defect
|
|
526
|
+
* (`Die`). If the function matches the defect, that defect is removed. If all
|
|
527
|
+
* defects match, the result is `None`. Otherwise, you get a `Cause` with the
|
|
528
|
+
* unmatched defects.
|
|
291
529
|
*
|
|
292
530
|
* @since 2.0.0
|
|
293
|
-
* @category
|
|
531
|
+
* @category Getters
|
|
294
532
|
*/
|
|
295
533
|
export const stripSomeDefects = internal.stripSomeDefects;
|
|
296
534
|
/**
|
|
535
|
+
* Replaces any errors in a `Cause` with a provided constant error.
|
|
536
|
+
*
|
|
537
|
+
* **Details**
|
|
538
|
+
*
|
|
539
|
+
* This function transforms all `Fail` errors into the specified error value,
|
|
540
|
+
* preserving the structure of the `Cause`. It's useful when you no longer need
|
|
541
|
+
* the original error details but still want to keep the cause shape.
|
|
542
|
+
*
|
|
543
|
+
* @see {@link map} Apply a custom transformation to `Fail` errors
|
|
544
|
+
*
|
|
297
545
|
* @since 2.0.0
|
|
298
|
-
* @category
|
|
546
|
+
* @category Mapping
|
|
299
547
|
*/
|
|
300
548
|
export const as = internal.as;
|
|
301
549
|
/**
|
|
550
|
+
* Transforms the errors in a `Cause` using a user-provided function.
|
|
551
|
+
*
|
|
552
|
+
* **Details**
|
|
553
|
+
*
|
|
554
|
+
* This function applies `f` to each `Fail` error while leaving defects (`Die`)
|
|
555
|
+
* and interruptions untouched. It's useful for changing or simplifying error
|
|
556
|
+
* types in your effectful workflows.
|
|
557
|
+
*
|
|
558
|
+
* @see {@link as} Replace errors with a single constant
|
|
559
|
+
*
|
|
302
560
|
* @since 2.0.0
|
|
303
|
-
* @category
|
|
561
|
+
* @category Mapping
|
|
304
562
|
*/
|
|
305
563
|
export const map = internal.map;
|
|
306
564
|
/**
|
|
565
|
+
* Transforms errors in a `Cause` into new causes.
|
|
566
|
+
*
|
|
567
|
+
* **Details**
|
|
568
|
+
*
|
|
569
|
+
* This function applies a function `f` to each `Fail` error, converting it into
|
|
570
|
+
* a new `Cause`. This is especially powerful for merging or restructuring error
|
|
571
|
+
* types while preserving or combining cause information.
|
|
572
|
+
*
|
|
573
|
+
* @see {@link map} Apply a simpler transformation to errors
|
|
574
|
+
*
|
|
307
575
|
* @since 2.0.0
|
|
308
|
-
* @category
|
|
576
|
+
* @category Sequencing
|
|
309
577
|
*/
|
|
310
578
|
export const flatMap = internal.flatMap;
|
|
311
579
|
/**
|
|
312
|
-
*
|
|
580
|
+
* Sequences two `Cause`s. The second `Cause` can be dependent on the result of
|
|
581
|
+
* the first `Cause`.
|
|
313
582
|
*
|
|
314
583
|
* @since 2.0.0
|
|
315
|
-
* @category
|
|
584
|
+
* @category Sequencing
|
|
316
585
|
*/
|
|
317
586
|
export const andThen = internal.andThen;
|
|
318
587
|
/**
|
|
588
|
+
* Flattens a nested `Cause` structure.
|
|
589
|
+
*
|
|
590
|
+
* **Details**
|
|
591
|
+
*
|
|
592
|
+
* This function takes a `Cause<Cause<E>>` and merges the layers into a single
|
|
593
|
+
* `Cause<E>`. It's useful for eliminating additional nesting created by
|
|
594
|
+
* repeated transformations or compositions.
|
|
595
|
+
*
|
|
596
|
+
* @see {@link flatMap} Compose nested causes
|
|
597
|
+
*
|
|
319
598
|
* @since 2.0.0
|
|
320
|
-
* @category
|
|
599
|
+
* @category Sequencing
|
|
321
600
|
*/
|
|
322
601
|
export const flatten = internal.flatten;
|
|
323
602
|
/**
|
|
324
|
-
*
|
|
325
|
-
*
|
|
603
|
+
* Checks if the current `Cause` contains or is equal to another `Cause`.
|
|
604
|
+
*
|
|
605
|
+
* **Details**
|
|
606
|
+
*
|
|
607
|
+
* This function returns `true` if `that` cause is part of or the same as
|
|
608
|
+
* the current `Cause`. It's useful when you need to check for specific
|
|
609
|
+
* error patterns or deduplicate repeated failures.
|
|
326
610
|
*
|
|
327
611
|
* @since 2.0.0
|
|
328
|
-
* @category
|
|
612
|
+
* @category Elements
|
|
329
613
|
*/
|
|
330
614
|
export const contains = internal.contains;
|
|
331
615
|
/**
|
|
332
|
-
*
|
|
333
|
-
*
|
|
616
|
+
* Extracts the most "important" defect from a `Cause`.
|
|
617
|
+
*
|
|
618
|
+
* **Details**
|
|
619
|
+
*
|
|
620
|
+
* This function reduces a `Cause` to a single, prioritized defect. It evaluates
|
|
621
|
+
* the `Cause` in the following order of priority:
|
|
622
|
+
*
|
|
623
|
+
* 1. If the `Cause` contains a failure (e.g., from `Effect.fail`), it returns
|
|
624
|
+
* the raw error value.
|
|
625
|
+
* 2. If there is no failure, it looks for the first defect (e.g., from
|
|
626
|
+
* `Effect.die`).
|
|
627
|
+
* 3. If neither of the above is present, and the `Cause` stems from an
|
|
628
|
+
* interruption, it creates and returns an `InterruptedException`.
|
|
629
|
+
*
|
|
630
|
+
* This function ensures you can always extract a meaningful representation of
|
|
631
|
+
* the primary issue from a potentially complex `Cause` structure.
|
|
632
|
+
*
|
|
633
|
+
* **When to Use**
|
|
634
|
+
*
|
|
635
|
+
* Use this function when you need to extract the most relevant error or defect
|
|
636
|
+
* from a `Cause`, especially in scenarios where multiple errors or defects may
|
|
637
|
+
* be present. It's particularly useful for simplifying error reporting or
|
|
638
|
+
* logging.
|
|
639
|
+
*
|
|
640
|
+
* @see {@link squashWith} Allows transforming failures into defects when squashing.
|
|
334
641
|
*
|
|
335
642
|
* @since 2.0.0
|
|
336
|
-
* @category
|
|
643
|
+
* @category Destructors
|
|
337
644
|
*/
|
|
338
645
|
export const squash = core.causeSquash;
|
|
339
646
|
/**
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
*
|
|
647
|
+
* Extracts the most "important" defect from a `Cause`, transforming failures
|
|
648
|
+
* into defects using a provided function.
|
|
649
|
+
*
|
|
650
|
+
* **Details**
|
|
651
|
+
*
|
|
652
|
+
* This function reduces a `Cause` to a single, prioritized defect, while
|
|
653
|
+
* allowing you to transform recoverable failures into defects through a custom
|
|
654
|
+
* function. It processes the `Cause` in the following order:
|
|
655
|
+
*
|
|
656
|
+
* 1. If the `Cause` contains a failure (e.g., from `Effect.fail`), it applies
|
|
657
|
+
* the provided function `f` to the error to transform it into a defect.
|
|
658
|
+
* 2. If there is no failure, it looks for the first defect (e.g., from
|
|
659
|
+
* `Effect.die`) and returns it.
|
|
660
|
+
* 3. If neither is present and the `Cause` stems from an interruption, it
|
|
661
|
+
* returns an `InterruptedException`.
|
|
662
|
+
*
|
|
663
|
+
* This function is particularly useful when you need custom handling or
|
|
664
|
+
* transformation of errors while processing a `Cause`.
|
|
665
|
+
*
|
|
666
|
+
* @see {@link squash} Extracts the most "important" defect without transforming failures.
|
|
343
667
|
*
|
|
344
668
|
* @since 2.0.0
|
|
345
|
-
* @category
|
|
669
|
+
* @category Destructors
|
|
346
670
|
*/
|
|
347
671
|
export const squashWith = core.causeSquashWith;
|
|
348
672
|
/**
|
|
349
|
-
*
|
|
350
|
-
*
|
|
673
|
+
* Searches a `Cause` using a partial function to extract information.
|
|
674
|
+
*
|
|
675
|
+
* **Details**
|
|
676
|
+
*
|
|
677
|
+
* This function allows you to search through a `Cause` using a custom partial
|
|
678
|
+
* function. The partial function is applied to the `Cause`, and if it matches,
|
|
679
|
+
* the result is returned wrapped in a `Some`. If no match is found, the result
|
|
680
|
+
* is `None`.
|
|
681
|
+
*
|
|
682
|
+
* This is particularly useful when you are only interested in specific types of
|
|
683
|
+
* errors, defects, or interruption causes within a potentially complex `Cause`
|
|
684
|
+
* structure. By leveraging a partial function, you can focus on extracting only
|
|
685
|
+
* the relevant information you care about.
|
|
686
|
+
*
|
|
687
|
+
* The partial function should return an `Option` indicating whether it matched
|
|
688
|
+
* and the value it extracted.
|
|
351
689
|
*
|
|
352
690
|
* @since 2.0.0
|
|
353
|
-
* @category
|
|
691
|
+
* @category Elements
|
|
354
692
|
*/
|
|
355
693
|
export const find = internal.find;
|
|
356
694
|
/**
|
|
357
|
-
*
|
|
695
|
+
* Preserves parts of a `Cause` that match a given predicate.
|
|
696
|
+
*
|
|
697
|
+
* **Details**
|
|
698
|
+
*
|
|
699
|
+
* This function allows you to retain only the parts of a `Cause` structure that
|
|
700
|
+
* match a specified predicate or refinement. Any parts of the `Cause` that do
|
|
701
|
+
* not match the provided condition are excluded from the result.
|
|
702
|
+
*
|
|
703
|
+
* You can use this function in two ways:
|
|
704
|
+
* - With a `Predicate`: A function that evaluates whether a `Cause` should be
|
|
705
|
+
* retained based on its value.
|
|
706
|
+
* - With a `Refinement`: A more specific predicate that can refine the type of
|
|
707
|
+
* the `Cause`.
|
|
708
|
+
*
|
|
709
|
+
* This is useful when you need to extract specific types of errors, defects, or
|
|
710
|
+
* interruptions from a `Cause` while discarding unrelated parts.
|
|
358
711
|
*
|
|
359
712
|
* @since 2.0.0
|
|
360
|
-
* @category
|
|
713
|
+
* @category Filtering
|
|
361
714
|
*/
|
|
362
715
|
export const filter = internal.filter;
|
|
363
716
|
/**
|
|
364
|
-
*
|
|
717
|
+
* Transforms a `Cause` into a single value using custom handlers for each
|
|
718
|
+
* possible case.
|
|
719
|
+
*
|
|
720
|
+
* **Details**
|
|
721
|
+
*
|
|
722
|
+
* This function processes a `Cause` by applying a set of custom handlers to
|
|
723
|
+
* each possible type of cause: `Empty`, `Fail`, `Die`, `Interrupt`,
|
|
724
|
+
* `Sequential`, and `Parallel`. The result of this function is a single value
|
|
725
|
+
* of type `Z`. This function allows you to define exactly how to handle each
|
|
726
|
+
* part of a `Cause`, whether it's a failure, defect, interruption, or a
|
|
727
|
+
* combination of these.
|
|
728
|
+
*
|
|
729
|
+
* The options parameter provides handlers for:
|
|
730
|
+
* - `onEmpty`: Handles the case where the cause is `Empty`, meaning no errors
|
|
731
|
+
* occurred.
|
|
732
|
+
* - `onFail`: Processes a failure with an error of type `E`.
|
|
733
|
+
* - `onDie`: Processes a defect (unexpected error).
|
|
734
|
+
* - `onInterrupt`: Handles a fiber interruption, providing the `FiberId` of the
|
|
735
|
+
* interruption.
|
|
736
|
+
* - `onSequential`: Combines two sequential causes into a single value of type
|
|
737
|
+
* `Z`.
|
|
738
|
+
* - `onParallel`: Combines two parallel causes into a single value of type `Z`.
|
|
365
739
|
*
|
|
366
740
|
* @since 2.0.0
|
|
367
|
-
* @category
|
|
741
|
+
* @category Matching
|
|
368
742
|
*/
|
|
369
743
|
export const match = internal.match;
|
|
370
744
|
/**
|
|
371
|
-
*
|
|
372
|
-
*
|
|
745
|
+
* Combines all parts of a `Cause` into a single value by starting with an
|
|
746
|
+
* initial value.
|
|
747
|
+
*
|
|
748
|
+
* **Details**
|
|
749
|
+
*
|
|
750
|
+
* This function processes a `Cause` by starting with an initial value (`zero`)
|
|
751
|
+
* and applying a custom function (`pf`) to combine all elements of the `Cause`
|
|
752
|
+
* into a single result of type `Z`. The custom function determines how each
|
|
753
|
+
* part of the `Cause` contributes to the final result. The function can return
|
|
754
|
+
* an `Option` to either continue combining values or skip specific parts of the
|
|
755
|
+
* `Cause`.
|
|
756
|
+
*
|
|
757
|
+
* This function is useful for tasks such as:
|
|
758
|
+
* - Aggregating error messages from a `Cause` into a single string.
|
|
759
|
+
* - Summarizing the structure of a `Cause` into a simplified result.
|
|
760
|
+
* - Filtering or processing only specific parts of a `Cause`.
|
|
761
|
+
*
|
|
762
|
+
* The reduction proceeds in a top-down manner, visiting all nodes in the
|
|
763
|
+
* `Cause` structure. This gives you complete control over how each part of the
|
|
764
|
+
* `Cause` contributes to the final result.
|
|
373
765
|
*
|
|
374
766
|
* @since 2.0.0
|
|
375
|
-
* @category
|
|
767
|
+
* @category Reducing
|
|
376
768
|
*/
|
|
377
769
|
export const reduce = internal.reduce;
|
|
378
770
|
/**
|
|
379
|
-
*
|
|
380
|
-
*
|
|
771
|
+
* Combines all parts of a `Cause` into a single value using a custom reducer
|
|
772
|
+
* and a context.
|
|
773
|
+
*
|
|
774
|
+
* **Details**
|
|
775
|
+
*
|
|
776
|
+
* This function allows you to reduce a `Cause` into a single value of type `Z`
|
|
777
|
+
* using a custom `CauseReducer`. A `CauseReducer` provides methods to handle
|
|
778
|
+
* specific parts of the `Cause`, such as failures, defects, or interruptions.
|
|
779
|
+
* Additionally, this function provides access to a `context` value, which can
|
|
780
|
+
* be used to carry information or maintain state during the reduction process.
|
|
781
|
+
*
|
|
782
|
+
* This is particularly useful when the reduction process needs additional
|
|
783
|
+
* context or configuration, such as:
|
|
784
|
+
* - Aggregating error details with dynamic formatting.
|
|
785
|
+
* - Collecting logs or statistics about the `Cause`.
|
|
786
|
+
* - Performing stateful transformations based on the `context`.
|
|
787
|
+
*
|
|
788
|
+
* @see {@link reduce} To reduce a `Cause` without additional context.
|
|
381
789
|
*
|
|
382
790
|
* @since 2.0.0
|
|
383
|
-
* @category
|
|
791
|
+
* @category Reducing
|
|
384
792
|
*/
|
|
385
793
|
export const reduceWithContext = internal.reduceWithContext;
|
|
386
794
|
/**
|
|
387
|
-
*
|
|
795
|
+
* Creates an error that indicates a `Fiber` was interrupted.
|
|
796
|
+
*
|
|
797
|
+
* **Details**
|
|
798
|
+
*
|
|
799
|
+
* This function constructs an `InterruptedException` recognized by the Effect
|
|
800
|
+
* runtime. It is usually thrown or returned when a fiber's execution is
|
|
801
|
+
* interrupted by external events or by another fiber. This is particularly
|
|
802
|
+
* helpful in concurrent programs where fibers may halt each other before
|
|
803
|
+
* completion.
|
|
388
804
|
*
|
|
389
805
|
* @since 2.0.0
|
|
390
|
-
* @category
|
|
806
|
+
* @category Errors
|
|
391
807
|
*/
|
|
392
808
|
export const InterruptedException = core.InterruptedException;
|
|
393
809
|
/**
|
|
394
|
-
*
|
|
395
|
-
* otherwise.
|
|
810
|
+
* Checks if a given unknown value is an `InterruptedException`.
|
|
396
811
|
*
|
|
397
812
|
* @since 2.0.0
|
|
398
|
-
* @category
|
|
813
|
+
* @category Guards
|
|
399
814
|
*/
|
|
400
815
|
export const isInterruptedException = core.isInterruptedException;
|
|
401
816
|
/**
|
|
402
|
-
*
|
|
403
|
-
*
|
|
817
|
+
* Creates an error indicating an invalid method argument.
|
|
818
|
+
*
|
|
819
|
+
* **Details**
|
|
820
|
+
*
|
|
821
|
+
* This function constructs an `IllegalArgumentException`. It is typically
|
|
822
|
+
* thrown or returned when an operation receives improper inputs, such as
|
|
823
|
+
* out-of-range values or invalid object states.
|
|
404
824
|
*
|
|
405
825
|
* @since 2.0.0
|
|
406
|
-
* @category
|
|
826
|
+
* @category Errors
|
|
407
827
|
*/
|
|
408
828
|
export const IllegalArgumentException = core.IllegalArgumentException;
|
|
409
829
|
/**
|
|
410
|
-
*
|
|
411
|
-
* otherwise.
|
|
830
|
+
* Checks if a given unknown value is an `IllegalArgumentException`.
|
|
412
831
|
*
|
|
413
832
|
* @since 2.0.0
|
|
414
|
-
* @category
|
|
833
|
+
* @category Guards
|
|
415
834
|
*/
|
|
416
835
|
export const isIllegalArgumentException = core.isIllegalArgumentException;
|
|
417
836
|
/**
|
|
418
|
-
*
|
|
419
|
-
*
|
|
837
|
+
* Creates an error indicating a missing element.
|
|
838
|
+
*
|
|
839
|
+
* **Details**
|
|
840
|
+
*
|
|
841
|
+
* This function constructs a `NoSuchElementException`. It helps you clearly
|
|
842
|
+
* communicate that a required element is unavailable.
|
|
420
843
|
*
|
|
421
844
|
* @since 2.0.0
|
|
422
|
-
* @category
|
|
845
|
+
* @category Errors
|
|
423
846
|
*/
|
|
424
847
|
export const NoSuchElementException = core.NoSuchElementException;
|
|
425
848
|
/**
|
|
426
|
-
*
|
|
427
|
-
* otherwise.
|
|
849
|
+
* Checks if a given unknown value is a `NoSuchElementException`.
|
|
428
850
|
*
|
|
429
851
|
* @since 2.0.0
|
|
430
|
-
* @category
|
|
852
|
+
* @category Guards
|
|
431
853
|
*/
|
|
432
854
|
export const isNoSuchElementException = core.isNoSuchElementException;
|
|
433
855
|
/**
|
|
434
|
-
*
|
|
856
|
+
* Creates an error for general runtime errors.
|
|
857
|
+
*
|
|
858
|
+
* **Details**
|
|
859
|
+
*
|
|
860
|
+
* This function constructs a `RuntimeException`, for errors that occur at
|
|
861
|
+
* runtime but are not specifically typed or categorized as interruptions,
|
|
862
|
+
* missing elements, or invalid arguments. It helps unify a wide range of
|
|
863
|
+
* unexpected conditions under a single, recognizable error type.
|
|
435
864
|
*
|
|
436
865
|
* @since 2.0.0
|
|
437
|
-
* @category
|
|
866
|
+
* @category Errors
|
|
438
867
|
*/
|
|
439
868
|
export const RuntimeException = core.RuntimeException;
|
|
440
869
|
/**
|
|
441
|
-
*
|
|
442
|
-
* otherwise.
|
|
870
|
+
* Checks if a given unknown value is a `RuntimeException`.
|
|
443
871
|
*
|
|
444
872
|
* @since 2.0.0
|
|
445
|
-
* @category
|
|
873
|
+
* @category Guards
|
|
446
874
|
*/
|
|
447
875
|
export const isRuntimeException = core.isRuntimeException;
|
|
448
876
|
/**
|
|
449
|
-
*
|
|
450
|
-
*
|
|
877
|
+
* Creates an error for operations that exceed their expected time.
|
|
878
|
+
*
|
|
879
|
+
* **Details**
|
|
880
|
+
*
|
|
881
|
+
* This function constructs a `TimeoutException`. It is typically used to signal
|
|
882
|
+
* that an operation or fiber did not complete within a designated time limit,
|
|
883
|
+
* allowing you to handle slow or hanging processes.
|
|
451
884
|
*
|
|
452
885
|
* @since 2.0.0
|
|
453
|
-
* @category
|
|
886
|
+
* @category Errors
|
|
454
887
|
*/
|
|
455
888
|
export const TimeoutException = core.TimeoutException;
|
|
456
889
|
/**
|
|
@@ -482,52 +915,82 @@ export const TimeoutException = core.TimeoutException;
|
|
|
482
915
|
* promises or external APIs.
|
|
483
916
|
*
|
|
484
917
|
* @since 2.0.0
|
|
485
|
-
* @category
|
|
918
|
+
* @category Errors
|
|
486
919
|
*/
|
|
487
920
|
export const UnknownException = core.UnknownException;
|
|
488
921
|
/**
|
|
489
|
-
*
|
|
490
|
-
* otherwise.
|
|
922
|
+
* Checks if a given unknown value is an `UnknownException`.
|
|
491
923
|
*
|
|
492
924
|
* @since 2.0.0
|
|
493
|
-
* @category
|
|
925
|
+
* @category Guards
|
|
494
926
|
*/
|
|
495
927
|
export const isUnknownException = core.isUnknownException;
|
|
496
928
|
/**
|
|
497
|
-
*
|
|
498
|
-
*
|
|
929
|
+
* Creates an error indicating resource capacity has been exceeded.
|
|
930
|
+
*
|
|
931
|
+
* **Details**
|
|
932
|
+
*
|
|
933
|
+
* This function constructs an `ExceededCapacityException`, signifying that an
|
|
934
|
+
* operation or resource usage surpassed established limits. This can be
|
|
935
|
+
* essential for concurrency or resource management situations, ensuring your
|
|
936
|
+
* application doesn't go beyond acceptable thresholds.
|
|
499
937
|
*
|
|
500
938
|
* @since 3.5.0
|
|
501
|
-
* @category
|
|
939
|
+
* @category Errors
|
|
502
940
|
*/
|
|
503
941
|
export const ExceededCapacityException = core.ExceededCapacityException;
|
|
504
942
|
/**
|
|
505
|
-
*
|
|
506
|
-
* otherwise.
|
|
943
|
+
* Checks if a given unknown value is an `ExceededCapacityException`.
|
|
507
944
|
*
|
|
508
945
|
* @since 3.5.0
|
|
509
|
-
* @category
|
|
946
|
+
* @category Guards
|
|
510
947
|
*/
|
|
511
948
|
export const isExceededCapacityException = core.isExceededCapacityException;
|
|
512
949
|
/**
|
|
513
|
-
*
|
|
950
|
+
* Converts a `Cause` into a human-readable string.
|
|
951
|
+
*
|
|
952
|
+
* **Details**
|
|
953
|
+
*
|
|
954
|
+
* This function pretty-prints the entire `Cause`, including any failures,
|
|
955
|
+
* defects, and interruptions. It can be especially helpful for logging,
|
|
956
|
+
* debugging, or displaying structured errors to users.
|
|
957
|
+
*
|
|
958
|
+
* You can optionally pass `options` to configure how the error cause is
|
|
959
|
+
* rendered. By default, it includes essential details of all errors in the
|
|
960
|
+
* `Cause`.
|
|
961
|
+
*
|
|
962
|
+
* @see {@link prettyErrors} Get a list of `PrettyError` objects instead of a single string.
|
|
514
963
|
*
|
|
515
964
|
* @since 2.0.0
|
|
516
|
-
* @category
|
|
965
|
+
* @category Formatting
|
|
517
966
|
*/
|
|
518
967
|
export const pretty = internal.pretty;
|
|
519
968
|
/**
|
|
520
|
-
* Returns
|
|
969
|
+
* Returns a list of prettified errors (`PrettyError`) from a `Cause`.
|
|
970
|
+
*
|
|
971
|
+
* **Details**
|
|
972
|
+
*
|
|
973
|
+
* This function inspects the entire `Cause` and produces an array of
|
|
974
|
+
* `PrettyError` objects. Each object may include additional metadata, such as a
|
|
975
|
+
* `Span`, to provide deeper insights into where and how the error occurred.
|
|
521
976
|
*
|
|
522
977
|
* @since 3.2.0
|
|
523
|
-
* @category
|
|
978
|
+
* @category Formatting
|
|
524
979
|
*/
|
|
525
980
|
export const prettyErrors = internal.prettyErrors;
|
|
526
981
|
/**
|
|
527
|
-
*
|
|
982
|
+
* Retrieves the original, unproxied error instance from an error object.
|
|
983
|
+
*
|
|
984
|
+
* **Details**
|
|
985
|
+
*
|
|
986
|
+
* This function returns the underlying error object without any
|
|
987
|
+
* library-specific wrapping or proxying that might occur during error handling.
|
|
988
|
+
* This can be essential if you need direct access to the error's native
|
|
989
|
+
* properties, such as stack traces or custom data fields, for detailed
|
|
990
|
+
* debugging or integration with external systems.
|
|
528
991
|
*
|
|
529
992
|
* @since 2.0.0
|
|
530
|
-
* @category
|
|
993
|
+
* @category Errors
|
|
531
994
|
*/
|
|
532
995
|
export const originalError = core.originalInstance;
|
|
533
996
|
//# sourceMappingURL=Cause.js.map
|