(input: unknown, depth = 0)
| 284 | * itself be a `Cause` (an inner `runPromise` rejecting with its own squashed |
| 285 | * cause), so the walk unwraps a few levels. */ |
| 286 | const errorValuesOf = (input: unknown, depth = 0): readonly unknown[] => { |
| 287 | if (depth >= MAX_CAUSE_NESTING) return []; |
| 288 | if (!Cause.isCause(input)) return [input]; |
| 289 | const values: unknown[] = []; |
| 290 | for (const reason of input.reasons) { |
| 291 | if (Cause.isFailReason(reason)) values.push(reason.error); |
| 292 | else if (Cause.isDieReason(reason)) values.push(...errorValuesOf(reason.defect, depth + 1)); |
| 293 | } |
| 294 | return values; |
| 295 | }; |
| 296 | |
| 297 | /** Read the classification fields off the tagged errors inside a cause. First |
| 298 | * writer wins, so the innermost reported error names the issue. */ |
no test coverage detected