Skip to content

Commit bb0080e

Browse files
authored
Fix exception not created from HEAD requests (#1724)
1 parent c04c859 commit bb0080e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Generator/OperationGenerator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ private function setMethodBody(Method $method, Operation $operation, ClassName $
198198
$classBuilder->addUse($errorClass->getFqdn());
199199

200200
$mapping[] = sprintf('%s => %s::class,', var_export($error->getCode() ?? $error->getName(), true), $errorClass->getName());
201+
if ('HEAD' === $operation->getHttpMethod() && ($statusCode = $error->getStatusCode()) >= 400) {
202+
$this->requirementsRegistry->addRequirement('async-aws/core', '^1.22');
203+
$mapping[] = sprintf('%s => %s::class,', var_export('http_status_code_' . $statusCode, true), $errorClass->getName());
204+
}
201205
}
202206
if ($mapping) {
203207
$extra .= ", 'exceptionMapping' => [\n" . implode("\n", $mapping) . "\n]";

0 commit comments

Comments
 (0)