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

Method fatal

packages/sql/pg/src/PgConnection.ts:651–667  ·  view source on GitHub ↗
(error: SqlError, destroySocket = true)

Source from the content-addressed store, hash-verified

649 }
650
651 fatal(error: SqlError, destroySocket = true): void {
652 if (this.deadWith !== undefined) return
653 this.deadWith = error
654 if (destroySocket) this.session.socket.destroy()
655 const consumer = this.consumer
656 this.consumer = undefined
657 if (!this.closed) {
658 for (const hook of this.retireHooks) hook()
659 }
660 consumer?.onFatal(error)
661 const sets = Array.from(this.channels.values())
662 this.channels.clear()
663 const cause = this.closed ? Cause.interrupt() : Cause.fail(error)
664 for (const set of sets) {
665 for (const queue of set) Queue.failCauseUnsafe(queue, cause)
666 }
667 }
668
669 closeUnsafe(): void {
670 this.closed = true

Callers 8

PgConnectionImplClass · 0.95
closeUnsafeMethod · 0.95
failDesyncMethod · 0.80
onMessageMethod · 0.80
drainAbortedFunction · 0.80
runQueryFunction · 0.80
failFatalFunction · 0.80
unlistenFunction · 0.80

Calls 7

hookFunction · 0.85
onFatalMethod · 0.80
fromMethod · 0.80
clearMethod · 0.65
failMethod · 0.65
destroyMethod · 0.45
interruptMethod · 0.45

Tested by

no test coverage detected