MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / errorValuesOf

Function errorValuesOf

apps/cloud/src/observability/index.ts:286–295  ·  view source on GitHub ↗
(input: unknown, depth = 0)

Source from the content-addressed store, hash-verified

284 * itself be a `Cause` (an inner `runPromise` rejecting with its own squashed
285 * cause), so the walk unwraps a few levels. */
286const 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. */

Callers 1

classificationTagsOfFunction · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected