{"version":3,"file":"exceptions.mjs","names":[],"sources":["../../../../src/batteries/generation/openai/exceptions.ts"],"sourcesContent":["/**\n * Battery-scoped exception constructors for OpenAI media generation adapter failures.\n *\n * @module @nhtio/adk/batteries/generation/openai/exceptions\n *\n * @remarks\n * Battery-scoped exception classes for the OpenAI media generation adapter. These exceptions are\n * owned 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 OpenAI Embeddings battery one-to-one so batteries across domains fail\n * with 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 * `openAIGenerationOptionsSchema` — e.g. a missing/empty `model`, an unknown option key, or an\n * invalid enum value. Fatal: config bugs fail loud at construction time, not at generate/edit time.\n */\nexport const E_INVALID_OPENAI_GENERATION_OPTIONS = createException<[string]>(\n  'E_INVALID_OPENAI_GENERATION_OPTIONS',\n  'Invalid OpenAI Generation adapter options: %s',\n  'E_INVALID_OPENAI_GENERATION_OPTIONS',\n  529,\n  true\n)\n\n/**\n * Thrown when the upstream `/v1/images/generations` or `/v1/images/edits` endpoint returns a\n * non-2xx response (after retries are exhausted), or the transport throws. Non-fatal. Printf args:\n * `[status, detail]` — `status` is `0` for a transport-level failure with no HTTP response.\n */\nexport const E_OPENAI_GENERATION_HTTP_ERROR = createException<[number, string]>(\n  'E_OPENAI_GENERATION_HTTP_ERROR',\n  'OpenAI Generation HTTP error %d: %s',\n  'E_OPENAI_GENERATION_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_GENERATION_REQUEST_TIMEOUT = createException<[number]>(\n  'E_OPENAI_GENERATION_REQUEST_TIMEOUT',\n  'OpenAI Generation request timed out after %dms',\n  'E_OPENAI_GENERATION_REQUEST_TIMEOUT',\n  504,\n  false\n)\n\n/**\n * Thrown when a 2xx response body cannot be parsed into the expected `{ data: [{ b64_json }] }`\n * shape (malformed JSON, missing/empty `data`, or an entry missing `b64_json`). Non-fatal. Printf\n * arg: `[detail]`.\n */\nexport const E_OPENAI_GENERATION_MALFORMED_RESPONSE = createException<[string]>(\n  'E_OPENAI_GENERATION_MALFORMED_RESPONSE',\n  'OpenAI Generation response malformed: %s',\n  'E_OPENAI_GENERATION_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"}