Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions psalm.baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,4 @@
<code><![CDATA[$s3SignerOptions]]></code>
</NoValue>
</file>
<file src="src/Service/StepFunctions/src/Result/StartExecutionOutput.php">
<PossiblyFalsePropertyAssignmentValue>
<code><![CDATA[$d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $data['startDate']))]]></code>
</PossiblyFalsePropertyAssignmentValue>
</file>
<file src="src/Service/StepFunctions/src/Result/StopExecutionOutput.php">
<PossiblyFalsePropertyAssignmentValue>
<code><![CDATA[$d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $data['stopDate']))]]></code>
</PossiblyFalsePropertyAssignmentValue>
</file>
</files>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class JsonRpcParser extends RestJsonParser
protected function parseResponseTimestamp(Shape $shape, string $input, bool $required): string
{
if ($required) {
$body = '/** @var \DateTimeImmutable $d */ $d = \DateTimeImmutable::createFromFormat(\'U.u\', \sprintf(\'%.6F\', INPUT))';
$body = $this->rejectUnparsableTimestamp('\DateTimeImmutable::createFromFormat(\'U.u\', \sprintf(\'%.6F\', INPUT))');
} else {
$body = '(isset(INPUT) && ($d = \DateTimeImmutable::createFromFormat(\'U.u\', \sprintf(\'%.6F\', INPUT)))) ? $d : null';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use AsyncAws\CodeGenerator\Generator\GeneratorHelper;
use AsyncAws\CodeGenerator\Generator\Naming\ClassName;
use AsyncAws\CodeGenerator\Generator\Naming\NamespaceRegistry;
use AsyncAws\Core\Exception\UnparsableResponse;
use Nette\PhpGenerator\Method;
use Nette\PhpGenerator\Visibility;

Expand Down Expand Up @@ -161,14 +162,28 @@ protected function parseResponseTimestamp(Shape $shape, string $input, bool $req
}

if ($required) {
$body = '/** @var \DateTimeImmutable $d */ $d = ' . $body;
$body = $this->rejectUnparsableTimestamp($body);
} else {
$body = 'isset(INPUT) && ($d = ' . $body . ') ? $d : null';
}

return strtr($body, ['INPUT' => $input]);
}

/**
* createFromFormat() returns false on a malformed value, and no annotation convinces static
* analysis that it cannot happen here. The failure is raised instead, so that the generated
* code needs no baseline entry: the value comes from the response, which is exactly what
* UnparsableResponse describes.
*/
protected function rejectUnparsableTimestamp(string $body): string
{
$className = ClassName::createFromFqdn(UnparsableResponse::class);
$this->imports[] = $className;

return $body . ' ?: throw new ' . $className->getName() . "('Invalid timestamp received.')";
}

private function getInputAccessorName(Member $member): string
{
if ($member instanceof StructureMember) {
Expand Down
4 changes: 4 additions & 0 deletions src/Service/DynamoDb/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- AWS api-change: Vector indexes are a type of index in Amazon DynamoDB that enable similarity search on vector embedding stored in your table items. Vector indexes use approximate nearest neighbor search to find items whose vectors are most similar to a query vector that you provide.

### Changed

- Throw `UnparsableResponse` instead of a `TypeError` when a required timestamp cannot be parsed

## 3.11.0

### Added
Expand Down
3 changes: 2 additions & 1 deletion src/Service/DynamoDb/src/Result/CreateTableOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace AsyncAws\DynamoDb\Result;

use AsyncAws\Core\Exception\UnparsableResponse;
use AsyncAws\Core\Response;
use AsyncAws\Core\Result;
use AsyncAws\DynamoDb\Enum\BillingMode;
Expand Down Expand Up @@ -332,7 +333,7 @@ private function populateResultRestoreSummary(array $json): RestoreSummary
return new RestoreSummary([
'SourceBackupArn' => isset($json['SourceBackupArn']) ? (string) $json['SourceBackupArn'] : null,
'SourceTableArn' => isset($json['SourceTableArn']) ? (string) $json['SourceTableArn'] : null,
'RestoreDateTime' => /** @var \DateTimeImmutable $d */ $d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['RestoreDateTime'])),
'RestoreDateTime' => \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['RestoreDateTime'])) ?: throw new UnparsableResponse('Invalid timestamp received.'),
'RestoreInProgress' => filter_var($json['RestoreInProgress'], \FILTER_VALIDATE_BOOLEAN),
]);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Service/DynamoDb/src/Result/DeleteTableOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace AsyncAws\DynamoDb\Result;

use AsyncAws\Core\Exception\UnparsableResponse;
use AsyncAws\Core\Response;
use AsyncAws\Core\Result;
use AsyncAws\DynamoDb\Enum\BillingMode;
Expand Down Expand Up @@ -332,7 +333,7 @@ private function populateResultRestoreSummary(array $json): RestoreSummary
return new RestoreSummary([
'SourceBackupArn' => isset($json['SourceBackupArn']) ? (string) $json['SourceBackupArn'] : null,
'SourceTableArn' => isset($json['SourceTableArn']) ? (string) $json['SourceTableArn'] : null,
'RestoreDateTime' => /** @var \DateTimeImmutable $d */ $d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['RestoreDateTime'])),
'RestoreDateTime' => \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['RestoreDateTime'])) ?: throw new UnparsableResponse('Invalid timestamp received.'),
'RestoreInProgress' => filter_var($json['RestoreInProgress'], \FILTER_VALIDATE_BOOLEAN),
]);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Service/DynamoDb/src/Result/DescribeTableOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace AsyncAws\DynamoDb\Result;

use AsyncAws\Core\Exception\UnparsableResponse;
use AsyncAws\Core\Response;
use AsyncAws\Core\Result;
use AsyncAws\DynamoDb\Enum\BillingMode;
Expand Down Expand Up @@ -332,7 +333,7 @@ private function populateResultRestoreSummary(array $json): RestoreSummary
return new RestoreSummary([
'SourceBackupArn' => isset($json['SourceBackupArn']) ? (string) $json['SourceBackupArn'] : null,
'SourceTableArn' => isset($json['SourceTableArn']) ? (string) $json['SourceTableArn'] : null,
'RestoreDateTime' => /** @var \DateTimeImmutable $d */ $d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['RestoreDateTime'])),
'RestoreDateTime' => \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['RestoreDateTime'])) ?: throw new UnparsableResponse('Invalid timestamp received.'),
'RestoreInProgress' => filter_var($json['RestoreInProgress'], \FILTER_VALIDATE_BOOLEAN),
]);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Service/DynamoDb/src/Result/UpdateTableOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace AsyncAws\DynamoDb\Result;

use AsyncAws\Core\Exception\UnparsableResponse;
use AsyncAws\Core\Response;
use AsyncAws\Core\Result;
use AsyncAws\DynamoDb\Enum\BillingMode;
Expand Down Expand Up @@ -332,7 +333,7 @@ private function populateResultRestoreSummary(array $json): RestoreSummary
return new RestoreSummary([
'SourceBackupArn' => isset($json['SourceBackupArn']) ? (string) $json['SourceBackupArn'] : null,
'SourceTableArn' => isset($json['SourceTableArn']) ? (string) $json['SourceTableArn'] : null,
'RestoreDateTime' => /** @var \DateTimeImmutable $d */ $d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['RestoreDateTime'])),
'RestoreDateTime' => \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['RestoreDateTime'])) ?: throw new UnparsableResponse('Invalid timestamp received.'),
'RestoreInProgress' => filter_var($json['RestoreInProgress'], \FILTER_VALIDATE_BOOLEAN),
]);
}
Expand Down
1 change: 1 addition & 0 deletions src/Service/Kinesis/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

### Changed

- Throw `UnparsableResponse` instead of a `TypeError` when a required timestamp cannot be parsed
- AWS enhancement: Documentation updates.

## 3.5.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace AsyncAws\Kinesis\Result;

use AsyncAws\Core\Exception\UnparsableResponse;
use AsyncAws\Core\Response;
use AsyncAws\Core\Result;
use AsyncAws\Kinesis\Enum\ConsumerStatus;
Expand Down Expand Up @@ -36,7 +37,7 @@ private function populateResultConsumerDescription(array $json): ConsumerDescrip
'ConsumerName' => (string) $json['ConsumerName'],
'ConsumerARN' => (string) $json['ConsumerARN'],
'ConsumerStatus' => !ConsumerStatus::exists((string) $json['ConsumerStatus']) ? ConsumerStatus::UNKNOWN_TO_SDK : (string) $json['ConsumerStatus'],
'ConsumerCreationTimestamp' => /** @var \DateTimeImmutable $d */ $d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['ConsumerCreationTimestamp'])),
'ConsumerCreationTimestamp' => \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['ConsumerCreationTimestamp'])) ?: throw new UnparsableResponse('Invalid timestamp received.'),
'StreamARN' => (string) $json['StreamARN'],
]);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Service/Kinesis/src/Result/DescribeStreamOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace AsyncAws\Kinesis\Result;

use AsyncAws\Core\Exception\InvalidArgument;
use AsyncAws\Core\Exception\UnparsableResponse;
use AsyncAws\Core\Response;
use AsyncAws\Core\Result;
use AsyncAws\Kinesis\Enum\EncryptionType;
Expand Down Expand Up @@ -174,7 +175,7 @@ private function populateResultStreamDescription(array $json): StreamDescription
'Shards' => $this->populateResultShardList($json['Shards']),
'HasMoreShards' => filter_var($json['HasMoreShards'], \FILTER_VALIDATE_BOOLEAN),
'RetentionPeriodHours' => (int) $json['RetentionPeriodHours'],
'StreamCreationTimestamp' => /** @var \DateTimeImmutable $d */ $d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['StreamCreationTimestamp'])),
'StreamCreationTimestamp' => \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['StreamCreationTimestamp'])) ?: throw new UnparsableResponse('Invalid timestamp received.'),
'EnhancedMonitoring' => $this->populateResultEnhancedMonitoringList($json['EnhancedMonitoring']),
'EncryptionType' => isset($json['EncryptionType']) ? (!EncryptionType::exists((string) $json['EncryptionType']) ? EncryptionType::UNKNOWN_TO_SDK : (string) $json['EncryptionType']) : null,
'KeyId' => isset($json['KeyId']) ? (string) $json['KeyId'] : null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace AsyncAws\Kinesis\Result;

use AsyncAws\Core\Exception\UnparsableResponse;
use AsyncAws\Core\Response;
use AsyncAws\Core\Result;
use AsyncAws\Kinesis\Enum\EncryptionType;
Expand Down Expand Up @@ -84,7 +85,7 @@ private function populateResultStreamDescriptionSummary(array $json): StreamDesc
'StreamStatus' => !StreamStatus::exists((string) $json['StreamStatus']) ? StreamStatus::UNKNOWN_TO_SDK : (string) $json['StreamStatus'],
'StreamModeDetails' => empty($json['StreamModeDetails']) ? null : $this->populateResultStreamModeDetails($json['StreamModeDetails']),
'RetentionPeriodHours' => (int) $json['RetentionPeriodHours'],
'StreamCreationTimestamp' => /** @var \DateTimeImmutable $d */ $d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['StreamCreationTimestamp'])),
'StreamCreationTimestamp' => \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['StreamCreationTimestamp'])) ?: throw new UnparsableResponse('Invalid timestamp received.'),
'EnhancedMonitoring' => $this->populateResultEnhancedMonitoringList($json['EnhancedMonitoring']),
'EncryptionType' => isset($json['EncryptionType']) ? (!EncryptionType::exists((string) $json['EncryptionType']) ? EncryptionType::UNKNOWN_TO_SDK : (string) $json['EncryptionType']) : null,
'KeyId' => isset($json['KeyId']) ? (string) $json['KeyId'] : null,
Expand Down
3 changes: 2 additions & 1 deletion src/Service/Kinesis/src/Result/ListStreamConsumersOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace AsyncAws\Kinesis\Result;

use AsyncAws\Core\Exception\InvalidArgument;
use AsyncAws\Core\Exception\UnparsableResponse;
use AsyncAws\Core\Response;
use AsyncAws\Core\Result;
use AsyncAws\Kinesis\Enum\ConsumerStatus;
Expand Down Expand Up @@ -113,7 +114,7 @@ private function populateResultConsumer(array $json): Consumer
'ConsumerName' => (string) $json['ConsumerName'],
'ConsumerARN' => (string) $json['ConsumerARN'],
'ConsumerStatus' => !ConsumerStatus::exists((string) $json['ConsumerStatus']) ? ConsumerStatus::UNKNOWN_TO_SDK : (string) $json['ConsumerStatus'],
'ConsumerCreationTimestamp' => /** @var \DateTimeImmutable $d */ $d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['ConsumerCreationTimestamp'])),
'ConsumerCreationTimestamp' => \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['ConsumerCreationTimestamp'])) ?: throw new UnparsableResponse('Invalid timestamp received.'),
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace AsyncAws\Kinesis\Result;

use AsyncAws\Core\Exception\UnparsableResponse;
use AsyncAws\Core\Response;
use AsyncAws\Core\Result;
use AsyncAws\Kinesis\Enum\ConsumerStatus;
Expand Down Expand Up @@ -37,7 +38,7 @@ private function populateResultConsumer(array $json): Consumer
'ConsumerName' => (string) $json['ConsumerName'],
'ConsumerARN' => (string) $json['ConsumerARN'],
'ConsumerStatus' => !ConsumerStatus::exists((string) $json['ConsumerStatus']) ? ConsumerStatus::UNKNOWN_TO_SDK : (string) $json['ConsumerStatus'],
'ConsumerCreationTimestamp' => /** @var \DateTimeImmutable $d */ $d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['ConsumerCreationTimestamp'])),
'ConsumerCreationTimestamp' => \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['ConsumerCreationTimestamp'])) ?: throw new UnparsableResponse('Invalid timestamp received.'),
]);
}
}
4 changes: 4 additions & 0 deletions src/Service/S3Vectors/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## NOT RELEASED

### Changed

- Throw `UnparsableResponse` instead of a `TypeError` when a required timestamp cannot be parsed

## 2.1.0

### Added
Expand Down
3 changes: 2 additions & 1 deletion src/Service/S3Vectors/src/Result/GetIndexOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace AsyncAws\S3Vectors\Result;

use AsyncAws\Core\Exception\UnparsableResponse;
use AsyncAws\Core\Response;
use AsyncAws\Core\Result;
use AsyncAws\S3Vectors\Enum\DataType;
Expand Down Expand Up @@ -48,7 +49,7 @@ private function populateResultIndex(array $json): Index
'vectorBucketName' => (string) $json['vectorBucketName'],
'indexName' => (string) $json['indexName'],
'indexArn' => (string) $json['indexArn'],
'creationTime' => /** @var \DateTimeImmutable $d */ $d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['creationTime'])),
'creationTime' => \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['creationTime'])) ?: throw new UnparsableResponse('Invalid timestamp received.'),
'dataType' => !DataType::exists((string) $json['dataType']) ? DataType::UNKNOWN_TO_SDK : (string) $json['dataType'],
'dimension' => (int) $json['dimension'],
'distanceMetric' => !DistanceMetric::exists((string) $json['distanceMetric']) ? DistanceMetric::UNKNOWN_TO_SDK : (string) $json['distanceMetric'],
Expand Down
3 changes: 2 additions & 1 deletion src/Service/S3Vectors/src/Result/GetVectorBucketOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace AsyncAws\S3Vectors\Result;

use AsyncAws\Core\Exception\UnparsableResponse;
use AsyncAws\Core\Response;
use AsyncAws\Core\Result;
use AsyncAws\S3Vectors\Enum\SseType;
Expand Down Expand Up @@ -44,7 +45,7 @@ private function populateResultVectorBucket(array $json): VectorBucket
return new VectorBucket([
'vectorBucketName' => (string) $json['vectorBucketName'],
'vectorBucketArn' => (string) $json['vectorBucketArn'],
'creationTime' => /** @var \DateTimeImmutable $d */ $d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['creationTime'])),
'creationTime' => \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['creationTime'])) ?: throw new UnparsableResponse('Invalid timestamp received.'),
'encryptionConfiguration' => empty($json['encryptionConfiguration']) ? null : $this->populateResultEncryptionConfiguration($json['encryptionConfiguration']),
]);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Service/S3Vectors/src/Result/ListIndexesOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace AsyncAws\S3Vectors\Result;

use AsyncAws\Core\Exception\InvalidArgument;
use AsyncAws\Core\Exception\UnparsableResponse;
use AsyncAws\Core\Response;
use AsyncAws\Core\Result;
use AsyncAws\S3Vectors\Input\ListIndexesInput;
Expand Down Expand Up @@ -103,7 +104,7 @@ private function populateResultIndexSummary(array $json): IndexSummary
'vectorBucketName' => (string) $json['vectorBucketName'],
'indexName' => (string) $json['indexName'],
'indexArn' => (string) $json['indexArn'],
'creationTime' => /** @var \DateTimeImmutable $d */ $d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['creationTime'])),
'creationTime' => \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['creationTime'])) ?: throw new UnparsableResponse('Invalid timestamp received.'),
]);
}

Expand Down
3 changes: 2 additions & 1 deletion src/Service/S3Vectors/src/Result/ListVectorBucketsOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace AsyncAws\S3Vectors\Result;

use AsyncAws\Core\Exception\InvalidArgument;
use AsyncAws\Core\Exception\UnparsableResponse;
use AsyncAws\Core\Response;
use AsyncAws\Core\Result;
use AsyncAws\S3Vectors\Input\ListVectorBucketsInput;
Expand Down Expand Up @@ -115,7 +116,7 @@ private function populateResultVectorBucketSummary(array $json): VectorBucketSum
return new VectorBucketSummary([
'vectorBucketName' => (string) $json['vectorBucketName'],
'vectorBucketArn' => (string) $json['vectorBucketArn'],
'creationTime' => /** @var \DateTimeImmutable $d */ $d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['creationTime'])),
'creationTime' => \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['creationTime'])) ?: throw new UnparsableResponse('Invalid timestamp received.'),
]);
}
}
4 changes: 4 additions & 0 deletions src/Service/Ses/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- AWS api-change: Amazon SES now supports per-message tracking overrides. You can use the new ConfigurationOverrides parameter in SendEmail and SendBulkEmail to enable or disable open and click tracking for individual messages without changing your account-level or configuration set settings.

### Changed

- Throw `UnparsableResponse` instead of a `TypeError` when a required timestamp cannot be parsed

## 1.16.0

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace AsyncAws\Ses\Result;

use AsyncAws\Core\Exception\UnparsableResponse;
use AsyncAws\Core\Response;
use AsyncAws\Core\Result;
use AsyncAws\Ses\Enum\SuppressionListReason;
Expand Down Expand Up @@ -39,7 +40,7 @@ private function populateResultSuppressedDestination(array $json): SuppressedDes
return new SuppressedDestination([
'EmailAddress' => (string) $json['EmailAddress'],
'Reason' => !SuppressionListReason::exists((string) $json['Reason']) ? SuppressionListReason::UNKNOWN_TO_SDK : (string) $json['Reason'],
'LastUpdateTime' => /** @var \DateTimeImmutable $d */ $d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['LastUpdateTime'])),
'LastUpdateTime' => \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['LastUpdateTime'])) ?: throw new UnparsableResponse('Invalid timestamp received.'),
'Attributes' => empty($json['Attributes']) ? null : $this->populateResultSuppressedDestinationAttributes($json['Attributes']),
'TenantName' => isset($json['TenantName']) ? (string) $json['TenantName'] : null,
]);
Expand Down
4 changes: 4 additions & 0 deletions src/Service/StepFunctions/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## NOT RELEASED

### Changed

- Throw `UnparsableResponse` instead of a `TypeError` when a required timestamp cannot be parsed

## 1.7.1

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace AsyncAws\StepFunctions\Result;

use AsyncAws\Core\Exception\UnparsableResponse;
use AsyncAws\Core\Response;
use AsyncAws\Core\Result;

Expand Down Expand Up @@ -40,6 +41,6 @@ protected function populateResult(Response $response): void
$data = $response->toArray();

$this->executionArn = (string) $data['executionArn'];
$this->startDate = /** @var \DateTimeImmutable $d */ $d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $data['startDate']));
$this->startDate = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $data['startDate'])) ?: throw new UnparsableResponse('Invalid timestamp received.');
}
}
Loading
Loading