Documentation
Errors
The typed error model exported by @milkeyskills/sdk.
Error classes
- MilkeyError
- MilkeyProblemError
- MilkeyResponseError
- MilkeyConfigError
- MilkeyTimeoutError
- MilkeyToolCallError
When they happen
- MilkeyConfigError: invalid `baseUrl`, empty API key, invalid timeout, conflicting `mode` and `delivery`, or unsupported mode requests.
- MilkeyProblemError: the backend returned RFC 9457 problem details.
- MilkeyResponseError: non-problem HTTP failures with status and raw body.
- MilkeyTimeoutError: request timeout on a Milkey backend call.
- MilkeyToolCallError: provider tool arguments were malformed before the SDK could execute the tool.
Handling
TS
try { const tools = milkey.openai.responses.tools({ client: milkeyClient, mode: "auto", })} catch (error) { if (error instanceof MilkeyConfigError) { // fix configuration or unsupported mode usage } else if (error instanceof MilkeyTimeoutError) { // retry or surface degraded dependency state } else { throw error }}Do not collapse all errors into one retry bucket
Config errors need fixes. Timeout errors may need retries. Problem-detail errors often need user-visible handling. Treat them differently.