FoPost LogoFoPost Docs
Core Concepts

Error Handling

How FoPost handles errors and exceptions.

Error Handling

OwlStack uses an exception-safe approach. The OwlStackClient catches all API errors internally and returns DeliveryResult objects with error details. It never throws exceptions.

Checking for errors

$results = $client->publish($post, [Platform::Twitter]);

foreach ($results as $result) {
    if ($result->isFailed()) {
        echo "Failed on {$result->platform()->value}: {$result->error()}\n";
        echo "Error code: {$result->errorCode()}\n";
    }
}

Error codes

CodeDescription
rate_limitedPlatform rate limit hit. OwlStack retries automatically.
content_too_longContent exceeds platform character limit after formatting.
media_invalidMedia type or size not supported by the platform.
auth_failedPlatform credentials are invalid or expired.
platform_errorUnexpected error from the platform API.
plan_limitYour plan's monthly post limit has been reached.
platform_not_connectedThe platform is not connected in your dashboard.
api_key_invalidInvalid or revoked API key.

Exception hierarchy (owlstack/core)

The owlstack/core package defines typed exception classes you can use in your own code:

use OwlStack\Exceptions\OwlStackException;
use OwlStack\Exceptions\AuthenticationException;
use OwlStack\Exceptions\RateLimitException;
use OwlStack\Exceptions\ContentTooLongException;
use OwlStack\Exceptions\MediaValidationException;
use OwlStack\Exceptions\PlatformException;

These are used internally by the cloud service. The SDK client translates API error responses into DeliveryResult objects, so you rarely need to catch them directly.

Retries

OwlStack automatically retries transient failures (rate limits, network timeouts) on the server side with exponential backoff. You don't need to implement retry logic in your application.

On this page