MCPcopy Create free account
hub / github.com/Effect-TS/effect / handleCause

Function handleCause

packages/platform/node/src/NodeHttpServer.ts:650–668  ·  view source on GitHub ↗
(
  nodeResponse: Http.ServerResponse,
  originalResponse: HttpServerResponse
)

Source from the content-addressed store, hash-verified

648}
649
650const handleCause = (
651 nodeResponse: Http.ServerResponse,
652 originalResponse: HttpServerResponse
653) =>
654<E>(originalCause: Cause.Cause<E>) =>
655 Effect.flatMap(causeResponse(originalCause), ([response, cause]) => {
656 const headersSent = nodeResponse.headersSent
657 if (!headersSent) {
658 nodeResponse.writeHead(response.status)
659 }
660 if (!nodeResponse.writableEnded) {
661 nodeResponse.end()
662 }
663 return Effect.failCause(
664 headersSent
665 ? Cause.combine(originalCause, Cause.die(originalResponse))
666 : cause
667 )
668 })

Callers 1

handleResponseFunction · 0.70

Calls 3

causeResponseFunction · 0.90
endMethod · 0.65
combineMethod · 0.65

Tested by

no test coverage detected