Skip to content

ApiCallException

Namespace: E2E.Decision.Sdk

public sealed class ApiCallException : Exception, ISerializable

The AI SDK’s APICallError: a provider call that failed. RunAsync retries it when IsRetryable, waiting for the provider’s retry-after-ms or retry-after header when it is reasonable.

Inheritance: object → Exception

Implements: ISerializable

View source

ApiCallException(string, int?, IReadOnlyDictionary<string, string>?, bool?, Exception?)

Section titled “ApiCallException(string, int?, IReadOnlyDictionary<string, string>?, bool?, Exception?)”
public ApiCallException(string message, int? statusCode = null, IReadOnlyDictionary<string, string>? responseHeaders = null, bool? isRetryable = null, Exception? innerException = null)

The AI SDK’s APICallError: a provider call that failed. RunAsync retries it when IsRetryable, waiting for the provider’s retry-after-ms or retry-after header when it is reasonable.

Parameters

Name Type Description
message string
statusCode int?
responseHeaders IReadOnlyDictionary<string, string>
isRetryable bool?
innerException Exception

public bool IsRetryable { get; }

Whether the call may be sent again. Upstream’s default: no answer at all, or a 408, 409, 429, or 5xx.

Value: bool

public JsonElement? ParsedData { get; init; }

The body the provider SDK already parsed, when it did (upstream APICallError.data; Exception.Data is taken). Null means there is none.

Value: JsonElement?

public string? ResponseBody { get; init; }

The body of the provider’s answer, when it sent one.

Value: string

public IReadOnlyDictionary<string, string>? ResponseHeaders { get; }

The provider’s response headers, lowercase names.

Value: IReadOnlyDictionary<string, string>

public int? StatusCode { get; }

The HTTP status of the provider’s answer; null when no answer came.

Value: int?