You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
virt/web/app/Services/Telegram/AdministratorTelegramPrefli...

28 lines
839 B
PHP

<?php
namespace App\Services\Telegram;
/** The Telegram network request is known not to have started. */
final class AdministratorTelegramPreflightException extends \RuntimeException
{
public const CHANNEL_UNAVAILABLE = 'channel_disabled_or_unavailable';
public const DESTINATION_CHANGED = 'destination_changed';
public const PAYLOAD_INVALID = 'payload_invalid';
public function __construct(
public readonly string $reason,
string $message
) {
if (!in_array($reason, [
self::CHANNEL_UNAVAILABLE,
self::DESTINATION_CHANGED,
self::PAYLOAD_INVALID,
], true)) {
throw new \InvalidArgumentException(
'Administrator Telegram preflight reason is invalid'
);
}
parent::__construct($message);
}
}