MCPcopy Create free account
hub / github.com/Snowflyt/tinyeffect / warnMultipleHandling

Function warnMultipleHandling

src/effected.ts:2738–2754  ·  view source on GitHub ↗
(type: "resume" | "terminate", ...args: [] | [R])

Source from the content-addressed store, hash-verified

2736 let resumedValue: R;
2737 let onComplete: ((...args: [] | [R]) => void) | null = null;
2738 const warnMultipleHandling = (type: "resume" | "terminate", ...args: [] | [R]) => {
2739 let message = `Effect ${stringifyEffectNameQuoted(effectName)} has been handled multiple times`;
2740 message += " (received `";
2741 message += `${type} ${stringifyEffect(effect)}`;
2742 if (args.length > 0) message += ` with ${stringify(args[0])}`;
2743 message += "` after it has been ";
2744 if (resumed) {
2745 message += "resumed";
2746 if (resumed === "with-value") message += ` with ${stringify(resumedValue)}`;
2747 } else if (context.terminated) {
2748 message += "terminated";
2749 if (context.terminated === "with-value")
2750 message += ` with ${stringify(context.terminatedValue)}`;
2751 }
2752 message += "). Only the first handler will be used.";
2753 logger.warn(message);
2754 };
2755 const resume = (...args: [] | [R]) => {
2756 if (resumed || context.terminated) {
2757 warnMultipleHandling("resume", ...args);

Callers 2

resumeFunction · 0.85
terminateFunction · 0.85

Calls 3

stringifyEffectFunction · 0.85
stringifyFunction · 0.70

Tested by

no test coverage detected