{"version":3,"file":"exceptions.mjs","names":[],"sources":["../../../../src/batteries/embeddings/openai/exceptions.ts"],"sourcesContent":["/**\n * Battery-scoped exception constructors for OpenAI Embeddings adapter failures.\n *\n * @module @nhtio/adk/batteries/embeddings/openai/exceptions\n *\n * @remarks\n * Battery-scoped exception classes for the OpenAI Embeddings adapter. These exceptions are owned\n * by the battery (not the ADK core) and are minted via `createException` from\n * `@nhtio/adk/factories`. Re-exported from the battery's barrel.\n *\n * The categories mirror the WebLLM Embeddings battery one-to-one so the two batteries fail with\n * parallel semantics — only the engine-specific transport exception differs.\n */\n\nimport { createException } from '@nhtio/adk/factories'\n\n/**\n * Thrown when the resolved adapter options fail validation against\n * `openAIEmbeddingsOptionsSchema` — e.g. a missing/empty `model`, or an unknown option key.\n * Fatal: config bugs fail loud at construction time, not at embed time.\n */\nexport const E_INVALID_OPENAI_EMBEDDINGS_OPTIONS = createException<[string]>(\n  'E_INVALID_OPENAI_EMBEDDINGS_OPTIONS',\n  'Invalid OpenAI Embeddings adapter options: %s',\n  'E_INVALID_OPENAI_EMBEDDINGS_OPTIONS',\n  529,\n  true\n)\n\n/**\n * Thrown when the upstream `/v1/embeddings` endpoint returns a non-2xx response (after retries\n * are exhausted), or the transport throws. Non-fatal. Printf args: `[status, detail]` — `status`\n * is `0` for a transport-level failure with no HTTP response.\n */\nexport const E_OPENAI_EMBEDDINGS_HTTP_ERROR = createException<[number, string]>(\n  'E_OPENAI_EMBEDDINGS_HTTP_ERROR',\n  'OpenAI Embeddings HTTP error %d: %s',\n  'E_OPENAI_EMBEDDINGS_HTTP_ERROR',\n  502,\n  false\n)\n\n/**\n * Thrown when the request handshake does not complete before `requestTimeoutMs` (and retries are\n * exhausted). Non-fatal. Printf arg: `[requestTimeoutMs]`.\n */\nexport const E_OPENAI_EMBEDDINGS_REQUEST_TIMEOUT = createException<[number]>(\n  'E_OPENAI_EMBEDDINGS_REQUEST_TIMEOUT',\n  'OpenAI Embeddings request timed out after %dms',\n  'E_OPENAI_EMBEDDINGS_REQUEST_TIMEOUT',\n  504,\n  false\n)\n\n/**\n * Thrown when a 2xx response body cannot be parsed into the expected\n * `{ data: [{ embedding: number[] }] }` shape (malformed JSON, missing `data`, wrong vector\n * count). Non-fatal. Printf arg: `[detail]`.\n */\nexport const E_OPENAI_EMBEDDINGS_MALFORMED_RESPONSE = createException<[string]>(\n  'E_OPENAI_EMBEDDINGS_MALFORMED_RESPONSE',\n  'OpenAI Embeddings response malformed: %s',\n  'E_OPENAI_EMBEDDINGS_MALFORMED_RESPONSE',\n  502,\n  false\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,IAAa,sCAAsC,gBACjD,uCACA,iDACA,uCACA,KACA,IACF;;;;;;AAOA,IAAa,iCAAiC,gBAC5C,kCACA,uCACA,kCACA,KACA,KACF;;;;;AAMA,IAAa,sCAAsC,gBACjD,uCACA,kDACA,uCACA,KACA,KACF;;;;;;AAOA,IAAa,yCAAyC,gBACpD,0CACA,4CACA,0CACA,KACA,KACF"}