ModelError
Base class for errors originating from LLM model providers.
Subtypes cover specific failure modes: rate limits, context overflow,
content filters, authentication, and network errors. The retryable
flag is set per subtype to guide retry middleware.
Extends
Section titled “Extends”Extended by
Section titled “Extended by”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ModelError(
message,provider,retryable,statusCode?,cause?):ModelError
Parameters
Section titled “Parameters”message
Section titled “message”string
provider
Section titled “provider”string
retryable
Section titled “retryable”boolean
statusCode?
Section titled “statusCode?”number
cause?
Section titled “cause?”Error
Returns
Section titled “Returns”ModelError
Overrides
Section titled “Overrides”Properties
Section titled “Properties”cause?
Section titled “cause?”
readonlyoptionalcause?:Error
Original error that caused this one, if any.
Inherited from
Section titled “Inherited from”code:
string
Machine-readable error code (e.g., “ABORT”, “RATE_LIMIT”, “TOOL_DENIED”).
Inherited from
Section titled “Inherited from”provider
Section titled “provider”
readonlyprovider:string
Provider name (e.g., “anthropic”, “openai”).
retryable
Section titled “retryable”
readonlyretryable:boolean
Whether this error can be retried by retry middleware.
Inherited from
Section titled “Inherited from”statusCode?
Section titled “statusCode?”
readonlyoptionalstatusCode?:number
HTTP status code from the provider API, if available.