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

Function connectionError

packages/effect/src/graphql/GraphQLProtocol.ts:742–759  ·  view source on GitHub ↗
(cause: Cause.Cause<unknown>)

Source from the content-addressed store, hash-verified

740 Array.isArray(u) && u.length > 0 && u.every((error) => isObject(error) && "message" in error)
741
742const connectionError = (cause: Cause.Cause<unknown>): TransportError => {
743 const found = Cause.findError(cause)
744 if (Result.isFailure(found)) {
745 return new TransportError({ description: "The graphql-ws connection was closed" })
746 }
747 const error = found.success
748 if (error instanceof TransportError) {
749 return error
750 }
751 if (Socket.isSocketError(error) && error.reason._tag === "SocketCloseError") {
752 return new TransportError({
753 description: `The graphql-ws connection closed with ${error.reason.message}`,
754 closeCode: error.reason.code,
755 cause: error
756 })
757 }
758 return new TransportError({ description: `The graphql-ws connection failed: ${errorMessage(error)}`, cause: error })
759}
760
761/**
762 * Builds the graphql-ws transport as an effect, for composing transports by

Callers 2

sendFunction · 0.85
makeWebSocketFunction · 0.85

Calls 1

errorMessageFunction · 0.85

Tested by

no test coverage detected