ai.errors.classify_http

HTTP status -> classified failure. The classifier attaches the body it received as raw_body, so a failure always carries what the provider said.

Reference version

Signature

function ai.errors.classify_http(
provider: string,
status_code: int,
body: string,
headers: map<string, string> | null = …

HTTP status -> classified failure. The classifier attaches the body it received as raw_body, so a failure always carries what the provider said.

headers is the response's header map when the caller has it (ai.wire.send_as passes resp.headers); it is what fills RateLimited.retry_after_ms. It defaults to null so a caller that only has a status and a body still compiles — such a call just cannot report a retry delay.

Source:<builtin>/ai/ns_errors/errors.bamlbytes 993310797