( sessionId: string | null, handle: string, close: (() => Promise<void>) | undefined, )
| 178 | * nothing can see, so name the handle and the session in a warning. |
| 179 | */ |
| 180 | const ignoreClose = ( |
| 181 | sessionId: string | null, |
| 182 | handle: string, |
| 183 | close: (() => Promise<void>) | undefined, |
| 184 | ): Promise<void> => { |
| 185 | if (!close) return Promise.resolve(); |
| 186 | const warn = (detail: unknown): Effect.Effect<void> => |
| 187 | Effect.sync(() => { |
| 188 | console.warn( |
| 189 | `[mcp] failed to close ${handle} for session ${sessionId ?? "<uninitialized>"}:`, |
| 190 | formatBoundaryError(detail), |
| 191 | ); |
| 192 | }); |
| 193 | return Effect.runPromise( |
| 194 | Effect.tryPromise({ try: close, catch: (cause) => new McpHandleCloseError({ cause }) }).pipe( |
| 195 | Effect.catch((error) => warn(error.cause)), |
| 196 | // A defect cannot escape either: this runs detached from any request. |
| 197 | Effect.catchCause((cause) => warn(Cause.squash(cause))), |
| 198 | ), |
| 199 | ); |
| 200 | }; |
| 201 | |
| 202 | // The store's error bodies are INNER responses (no CORS): the serving envelope |
| 203 | // re-wraps the store `Response` with CORS before it leaves the origin, so the |
no test coverage detected