Error Handling
The SDK throws typed exception classes for different failure scenarios, making it simple to handle specific error conditions in your application.
Exception Classes
All API exceptions extend the base FellohException class. You can catch the base class or target specific exception types.
| Exception Class | Status Code | Description |
|---|---|---|
FellohAuthenticationException | 401 | Invalid API credentials or expired token |
FellohForbiddenException | 403 | Insufficient permissions for the requested action |
FellohNotFoundException | 404 | The requested resource does not exist |
FellohValidationException | 422 | Request body failed validation — check Errors for field-level details |
FellohRateLimitException | 429 | API rate limit exceeded |
FellohServerException | 5xx | Server error — the SDK automatically retries these |
FellohNetworkException | — | Network failure (timeout, DNS, connection refused) — also retried automatically |
The FellohException Object
Every exception thrown by the SDK includes structured data about the failure.
Properties
- Name
Message- Type
- string
- Description
A human-readable error message.
- Name
StatusCode- Type
- int
- Description
The HTTP status code.
0for network-level failures.
- Name
Errors- Type
- List<FellohApiError>
- Description
A list of structured error objects returned by the API. Each includes
Title,Message,Code,Type, andDocumentationUrl.
- Name
Meta- Type
- ResponseMeta?
- Description
Response metadata including
RequestId— useful for debugging with Felloh support.
Error Handling
using Felloh.Errors;
try
{
await client.Bookings.GetAsync("non-existent-id");
}
catch (FellohNotFoundException)
{
Console.WriteLine("Booking not found");
}
catch (FellohValidationException ex)
{
// Inspect field-level validation errors
foreach (var error in ex.Errors)
{
Console.WriteLine($"{error.Title}: {error.Message}");
}
}
catch (FellohException ex)
{
Console.WriteLine($"Status: {ex.StatusCode}");
Console.WriteLine($"Errors: {ex.Errors.Count}");
Console.WriteLine($"Request ID: {ex.Meta?.RequestId}");
}
Automatic Retries
The SDK automatically retries requests that fail with a 5xx server error or a network error. Retries use exponential backoff
with a maximum of MaxRetries attempts (default: 2).
You can configure this when creating the client:
Configuring Retries
using Felloh;
using var client = new FellohClient(new FellohConfig
{
PublicKey = "your-public-key",
PrivateKey = "your-private-key",
MaxRetries = 3, // retry up to 3 times on 5xx/network errors
Timeout = 15000, // 15 second timeout per request
});
