Skip to main content

Error Handling

The SDK uses a consistent approach to error handling across all operations.

Behaviour by operation

OperationOn failure
CreateAsyncThrows InvalidOperationException with the API error message.
UpdateAsyncThrows InvalidOperationException with the API error message.
DeleteAsyncThrows InvalidOperationException with the API error message.
GetAsyncReturns null when the entity is not found.
SearchAsyncReturns an empty SearchResult<T> on failure.

Catching errors

try
{
    long id = await endpoint.CreateAsync(entity);
}
catch (InvalidOperationException ex)
{
    // ex.Message contains the API error details
    Console.WriteLine($"API error: {ex.Message}");
}

Rate limiting

The SDK automatically retries requests that receive an HTTP 429 Too Many Requests response. Retries use exponential backoff, so you don’t need to implement retry logic yourself.

Response types

For advanced scenarios, the SDK exposes the raw ApiResponse<T> envelope:
PropertyTypeDescription
ValueTThe deserialized response body.
WasSuccessfulboolWhether the API call succeeded.
MessagestringError or informational message from the API.
StatusCodeintThe HTTP status code.