MCPcopy
hub / github.com/Effect-TS/effect / handleCause

Function handleCause

packages/platform-node/src/internal/httpServer.ts:487–507  ·  view source on GitHub ↗
(
  nodeResponse: Http.ServerResponse,
  original: ServerResponse.HttpServerResponse
)

Source from the content-addressed store, hash-verified

485 })
486
487const handleCause = (
488 nodeResponse: Http.ServerResponse,
489 original: ServerResponse.HttpServerResponse
490) =>
491<E>(originalCause: Cause.Cause<E>) =>
492 Error.causeResponse(originalCause).pipe(
493 Effect.flatMap(([response, cause]) => {
494 const headersSent = nodeResponse.headersSent
495 if (!headersSent) {
496 nodeResponse.writeHead(response.status)
497 }
498 if (!nodeResponse.writableEnded) {
499 nodeResponse.end()
500 }
501 return Effect.failCause(
502 headersSent
503 ? Cause.sequential(originalCause, Cause.die(original))
504 : cause
505 )
506 })
507 )
508
509/** @internal */
510export const toIncomingMessage = (self: ServerRequest.HttpServerRequest): Http.IncomingMessage =>

Callers 1

handleResponseFunction · 0.85

Calls 4

failCauseMethod · 0.80
pipeMethod · 0.65
endMethod · 0.65
dieMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…