{"version":3,"file":"exceptions.mjs","names":[],"sources":["../../../../src/batteries/generation/gemini/exceptions.ts"],"sourcesContent":["/**\n * Battery-scoped exception constructors for Gemini media generation adapter failures.\n *\n * @module @nhtio/adk/batteries/generation/gemini/exceptions\n *\n * @remarks\n * Battery-scoped exception classes for the Gemini 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 Generation battery one-to-one so batteries across engines 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 * `geminiGenerationOptionsSchema` — e.g. a missing/empty `model`, an unknown option key, or an\n * invalid `responseModalities` entry. Fatal: config bugs fail loud at construction time, not at\n * generate/edit time.\n */\nexport const E_INVALID_GEMINI_GENERATION_OPTIONS = createException<[string]>(\n  'E_INVALID_GEMINI_GENERATION_OPTIONS',\n  'Invalid Gemini Generation adapter options: %s',\n  'E_INVALID_GEMINI_GENERATION_OPTIONS',\n  529,\n  true\n)\n\n/**\n * Thrown when the upstream `/models/{model}:generateContent` endpoint returns a non-2xx response\n * (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_GEMINI_GENERATION_HTTP_ERROR = createException<[number, string]>(\n  'E_GEMINI_GENERATION_HTTP_ERROR',\n  'Gemini Generation HTTP error %d: %s',\n  'E_GEMINI_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_GEMINI_GENERATION_REQUEST_TIMEOUT = createException<[number]>(\n  'E_GEMINI_GENERATION_REQUEST_TIMEOUT',\n  'Gemini Generation request timed out after %dms',\n  'E_GEMINI_GENERATION_REQUEST_TIMEOUT',\n  504,\n  false\n)\n\n/**\n * Thrown when a 2xx response body cannot be parsed into the expected candidates/parts shape, or\n * when it contains zero image parts (e.g. a safety refusal returning text only). In the\n * zero-image case the detail string includes any text parts' content so refusals surface legibly.\n * Non-fatal. Printf arg: `[detail]`.\n */\nexport const E_GEMINI_GENERATION_MALFORMED_RESPONSE = createException<[string]>(\n  'E_GEMINI_GENERATION_MALFORMED_RESPONSE',\n  'Gemini Generation response malformed: %s',\n  'E_GEMINI_GENERATION_MALFORMED_RESPONSE',\n  502,\n  false\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,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;;;;;;;AAQA,IAAa,yCAAyC,gBACpD,0CACA,4CACA,0CACA,KACA,KACF"}