# media-cloud-sync/1.2.8/includes/sdk/s3/Aws/S3/RetryableMalformedResponseParser.php

Media Cloud Sync, version 1.2.8. 40 lines.

- Page: https://pluginprobe.com/plugins/media-cloud-sync/1.2.8/code/includes/sdk/s3/Aws/S3/RetryableMalformedResponseParser.php
- Raw: https://pluginprobe.com/plugins/media-cloud-sync/1.2.8/raw/includes/sdk/s3/Aws/S3/RetryableMalformedResponseParser.php
- Modified: 2024-10-27T10:40:38+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/media-cloud-sync/1.2.8/code/includes/sdk/s3/Aws/S3/RetryableMalformedResponseParser.php#L10-L20`.

```php
<?php

namespace Dudlewebs\WPMCS\s3\Aws\S3;

use Dudlewebs\WPMCS\s3\Aws\Api\Parser\AbstractParser;
use Dudlewebs\WPMCS\s3\Aws\Api\StructureShape;
use Dudlewebs\WPMCS\s3\Aws\Api\Parser\Exception\ParserException;
use Dudlewebs\WPMCS\s3\Aws\CommandInterface;
use Dudlewebs\WPMCS\s3\Aws\Exception\AwsException;
use Dudlewebs\WPMCS\s3\Psr\Http\Message\ResponseInterface;
use Dudlewebs\WPMCS\s3\Psr\Http\Message\StreamInterface;
/**
 * Converts malformed responses to a retryable error type.
 *
 * @internal
 */
class RetryableMalformedResponseParser extends AbstractParser
{
    /** @var string */
    private $exceptionClass;
    public function __construct(callable $parser, $exceptionClass = AwsException::class)
    {
        $this->parser = $parser;
        $this->exceptionClass = $exceptionClass;
    }
    public function __invoke(CommandInterface $command, ResponseInterface $response)
    {
        $fn = $this->parser;
        try {
            return $fn($command, $response);
        } catch (ParserException $e) {
            throw new $this->exceptionClass("Error parsing response for {$command->getName()}:" . " AWS parsing error: {$e->getMessage()}", $command, ['connection_error' => \true, 'exception' => $e], $e);
        }
    }
    public function parseMemberFromStream(StreamInterface $stream, StructureShape $member, $response)
    {
        return $this->parser->parseMemberFromStream($stream, $member, $response);
    }
}

```
