1.1 KiB
1.1 KiB
kind, description
| kind | description |
|---|---|
| upgrade-guide | `new LlmError` accepts only built-in failure codes; other codes go through `LlmError.fromFailure`. |
new LlmError accepts only built-in failure codes
English | 中文
Change
In @deepseek-ai/dsh-llm, the code parameter of the LlmError constructor was string and is now BuiltinLlmFailureCode: a key of LLM_FAILURE_CODES or HTTP_<status>. Runtime behavior and LlmFailure.code are unchanged. TypeScript code that constructs LlmError with any other code, such as an out-of-tree provider adapter or a test double, no longer compiles.
Migration
- Replace each
new LlmError(message, code, options)whosecodeis not built-in withLlmError.fromFailure({ message, code, ...facts }, { cause }), wherefactsholds anystatus,providerRetryAfterMs,requestId, oroffloadImages. - Re-raise a failure received from a stream with
LlmError.fromFailure(finish.failure)instead of passingfinish.failure.codeto the constructor. - Confirm with
tscthat noLlmErrorconstruction reports a code that is not assignable toBuiltinLlmFailureCode.