feat(telegram): exception carrying permanent/retry_after flags

This commit is contained in:
Vladimir Bryzgalov
2026-04-17 22:39:04 +05:00
parent d3bd360357
commit 6961bb1b72
+27
View File
@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Cf7stg;
final class TelegramException extends \Exception
{
private bool $permanent;
private int $retry_after;
public function __construct(string $message, int $code = 0, bool $permanent = false, int $retry_after = 0)
{
parent::__construct($message, $code);
$this->permanent = $permanent;
$this->retry_after = max(0, $retry_after);
}
public function is_permanent(): bool
{
return $this->permanent;
}
public function retry_after(): int
{
return $this->retry_after;
}
}