public static function telegramRespondedWithAnError(ClientException $exception)
    {
        $statusCode = $exception->getResponse()->getStatusCode();

        $description = 'no description given';

        if ($result = json_decode($exception->getResponse()->getBody())) {
            $description = $result->description ?: $description;
        }

        return new static("Telegram responded with an error `{$statusCode} - {$description}`");
    }
public static function telegramRespondedWithAnError(ClientException $exception)
    {
        $statusCode = $exception->getResponse()->getStatusCode();

        $description = 'no description given';

        if ($result = json_decode($exception->getResponse()->getBody())) {
            $description = $result->description ?: $description;
        }

        return new static("Telegram responded with an error `{$statusCode} - {$description}`");
    }
public static function telegramRespondedWithAnError ( ClientException $ exception ) { $ statusCode = $ exception -> getResponse ( ) -> getStatusCode ( ) ; $ description = 'no description given' ; if ( $ result = json_decode ( $ exception -> getResponse ( ) -> getBody ( ) ) ) { $ description = $ result -> description ? : $ description ; } return new static ( "Telegram responded with an error `{$statusCode} - {$description}`" ) ; }
Thrown when there's a bad request and an error is responded.

@param ClientException $exception

@return static
Thrown when there s a bad request and an error is responded .