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

Function failErrorResponse

packages/sql/pg/src/PgConnection.ts:2464–2472  ·  view source on GitHub ↗
(fields: PgProtocol.ErrorFields, message: string)

Source from the content-addressed store, hash-verified

2462 const failAuth = (cause: unknown, message: string): void =>
2463 fail(new AuthenticationError({ cause, message, operation: "connect" }), "auth")
2464 const failErrorResponse = (fields: PgProtocol.ErrorFields, message: string): void => {
2465 const reason = classifyFields(fields, message, "connect")
2466 const code = fields.code
2467 fail(
2468 reason,
2469 reason._tag === "AuthenticationError" ? "auth" : "refused",
2470 code !== undefined && sqlStatePattern.test(code) ? code : undefined
2471 )
2472 }
2473
2474 const onError = (cause: Error) => failConnect(cause, "PgConnection: Failed to connect", "refused")
2475 const onClose = () =>

Callers 2

handleMessageFunction · 0.85
onSslResponseFunction · 0.85

Calls 2

classifyFieldsFunction · 0.85
failFunction · 0.70

Tested by

no test coverage detected