UNPKG

@langchain/langgraph-sdk

Version:

Client library for interacting with the LangGraph API

1 lines • 1.76 kB
{"version":3,"file":"error.cjs","names":[],"sources":["../../../src/client/stream/error.ts"],"sourcesContent":["import type { ErrorResponse } from \"@langchain/protocol\";\n\n/**\n * Error wrapper for protocol-level error responses returned by the server.\n */\nexport class ProtocolError extends Error {\n readonly code: ErrorResponse[\"error\"];\n readonly response: ErrorResponse;\n\n constructor(response: ErrorResponse) {\n super(response.message);\n this.name = \"ProtocolError\";\n this.code = response.error;\n this.response = response;\n }\n}\n\n/**\n * Thrown when the v2 WebSocket transport exhausts its automatic reconnect\n * budget (`maxReconnectAttempts`) after an unexpected socket close or error.\n *\n * The transport closes its event queue with this error so consumers of\n * `events()` can treat the stream as terminally failed. Set\n * `maxReconnectAttempts` to `0` on `client.threads.stream({ transport:\n * \"websocket\" })` to disable reconnect and fail fast on the first drop\n * instead.\n */\nexport class MaxWebSocketReconnectAttemptsError extends Error {\n /** The configured `maxReconnectAttempts` value that was exceeded. */\n readonly maxAttempts: number;\n\n constructor(maxAttempts: number, cause: unknown) {\n super(`Exceeded maximum WebSocket reconnection attempts (${maxAttempts})`);\n this.name = \"MaxWebSocketReconnectAttemptsError\";\n this.maxAttempts = maxAttempts;\n this.cause = cause;\n }\n}\n"],"mappings":";;;;AAKA,IAAa,gBAAb,cAAmC,MAAM;CACvC;CACA;CAEA,YAAY,UAAyB;AACnC,QAAM,SAAS,QAAQ;AACvB,OAAK,OAAO;AACZ,OAAK,OAAO,SAAS;AACrB,OAAK,WAAW;;;;;;;;;;;;;AAcpB,IAAa,qCAAb,cAAwD,MAAM;;CAE5D;CAEA,YAAY,aAAqB,OAAgB;AAC/C,QAAM,qDAAqD,YAAY,GAAG;AAC1E,OAAK,OAAO;AACZ,OAAK,cAAc;AACnB,OAAK,QAAQ"}