Skip to content
1 min read · 233 words

@nhtio/adk/batteries/generation/gemini/exceptions

Battery-scoped exception constructors for Gemini media generation adapter failures.

Remarks

Battery-scoped exception classes for the Gemini media generation adapter. These exceptions are owned by the battery (not the ADK core) and are minted via createException from @nhtio/adk/factories. Re-exported from the battery's barrel.

The categories mirror the OpenAI Generation battery one-to-one so batteries across engines fail with parallel semantics — only the engine-specific transport exception differs.

Variables

VariableDescription
E_GEMINI_GENERATION_HTTP_ERRORThrown when the upstream /models/{model}:generateContent endpoint returns a non-2xx response (after retries are exhausted), or the transport throws. Non-fatal. Printf args: [status, detail]status is 0 for a transport-level failure with no HTTP response.
E_GEMINI_GENERATION_MALFORMED_RESPONSEThrown when a 2xx response body cannot be parsed into the expected candidates/parts shape, or when it contains zero image parts (e.g. a safety refusal returning text only). In the zero-image case the detail string includes any text parts' content so refusals surface legibly. Non-fatal. Printf arg: [detail].
E_GEMINI_GENERATION_REQUEST_TIMEOUTThrown when the request handshake does not complete before requestTimeoutMs (and retries are exhausted). Non-fatal. Printf arg: [requestTimeoutMs].
E_INVALID_GEMINI_GENERATION_OPTIONSThrown when the resolved adapter options fail validation against geminiGenerationOptionsSchema — e.g. a missing/empty model, an unknown option key, or an invalid responseModalities entry. Fatal: config bugs fail loud at construction time, not at generate/edit time.