(type: "resume" | "terminate", ...args: [] | [R])
| 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); |
no test coverage detected