Skip to content

Commit 1663e33

Browse files
authored
Avoid overriding the exception message with the raw message (#1516)
1 parent abbd43a commit 1663e33

7 files changed

+0
-77
lines changed

src/Sts/Exception/ExpiredTokenException.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,11 @@
33
namespace AsyncAws\Core\Sts\Exception;
44

55
use AsyncAws\Core\Exception\Http\ClientException;
6-
use Symfony\Contracts\HttpClient\ResponseInterface;
76

87
/**
98
* The web identity token that was passed is expired or is not valid. Get a new identity token from the identity
109
* provider and then retry the request.
1110
*/
1211
final class ExpiredTokenException extends ClientException
1312
{
14-
protected function populateResult(ResponseInterface $response): void
15-
{
16-
$data = new \SimpleXMLElement($response->getContent(false));
17-
if (0 < $data->Error->count()) {
18-
$data = $data->Error;
19-
}
20-
if (null !== $v = (($v = $data->message) ? (string) $v : null)) {
21-
$this->message = $v;
22-
}
23-
}
2413
}

src/Sts/Exception/IDPCommunicationErrorException.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace AsyncAws\Core\Sts\Exception;
44

55
use AsyncAws\Core\Exception\Http\ClientException;
6-
use Symfony\Contracts\HttpClient\ResponseInterface;
76

87
/**
98
* The request could not be fulfilled because the identity provider (IDP) that was asked to verify the incoming identity
@@ -13,14 +12,4 @@
1312
*/
1413
final class IDPCommunicationErrorException extends ClientException
1514
{
16-
protected function populateResult(ResponseInterface $response): void
17-
{
18-
$data = new \SimpleXMLElement($response->getContent(false));
19-
if (0 < $data->Error->count()) {
20-
$data = $data->Error;
21-
}
22-
if (null !== $v = (($v = $data->message) ? (string) $v : null)) {
23-
$this->message = $v;
24-
}
25-
}
2615
}

src/Sts/Exception/IDPRejectedClaimException.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace AsyncAws\Core\Sts\Exception;
44

55
use AsyncAws\Core\Exception\Http\ClientException;
6-
use Symfony\Contracts\HttpClient\ResponseInterface;
76

87
/**
98
* The identity provider (IdP) reported that authentication failed. This might be because the claim is invalid.
@@ -13,14 +12,4 @@
1312
*/
1413
final class IDPRejectedClaimException extends ClientException
1514
{
16-
protected function populateResult(ResponseInterface $response): void
17-
{
18-
$data = new \SimpleXMLElement($response->getContent(false));
19-
if (0 < $data->Error->count()) {
20-
$data = $data->Error;
21-
}
22-
if (null !== $v = (($v = $data->message) ? (string) $v : null)) {
23-
$this->message = $v;
24-
}
25-
}
2615
}

src/Sts/Exception/InvalidIdentityTokenException.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,11 @@
33
namespace AsyncAws\Core\Sts\Exception;
44

55
use AsyncAws\Core\Exception\Http\ClientException;
6-
use Symfony\Contracts\HttpClient\ResponseInterface;
76

87
/**
98
* The web identity token that was passed could not be validated by Amazon Web Services. Get a new identity token from
109
* the identity provider and then retry the request.
1110
*/
1211
final class InvalidIdentityTokenException extends ClientException
1312
{
14-
protected function populateResult(ResponseInterface $response): void
15-
{
16-
$data = new \SimpleXMLElement($response->getContent(false));
17-
if (0 < $data->Error->count()) {
18-
$data = $data->Error;
19-
}
20-
if (null !== $v = (($v = $data->message) ? (string) $v : null)) {
21-
$this->message = $v;
22-
}
23-
}
2413
}

src/Sts/Exception/MalformedPolicyDocumentException.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,10 @@
33
namespace AsyncAws\Core\Sts\Exception;
44

55
use AsyncAws\Core\Exception\Http\ClientException;
6-
use Symfony\Contracts\HttpClient\ResponseInterface;
76

87
/**
98
* The request was rejected because the policy document was malformed. The error message describes the specific error.
109
*/
1110
final class MalformedPolicyDocumentException extends ClientException
1211
{
13-
protected function populateResult(ResponseInterface $response): void
14-
{
15-
$data = new \SimpleXMLElement($response->getContent(false));
16-
if (0 < $data->Error->count()) {
17-
$data = $data->Error;
18-
}
19-
if (null !== $v = (($v = $data->message) ? (string) $v : null)) {
20-
$this->message = $v;
21-
}
22-
}
2312
}

src/Sts/Exception/PackedPolicyTooLargeException.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace AsyncAws\Core\Sts\Exception;
44

55
use AsyncAws\Core\Exception\Http\ClientException;
6-
use Symfony\Contracts\HttpClient\ResponseInterface;
76

87
/**
98
* The request was rejected because the total packed size of the session policies and session tags combined was too
@@ -20,14 +19,4 @@
2019
*/
2120
final class PackedPolicyTooLargeException extends ClientException
2221
{
23-
protected function populateResult(ResponseInterface $response): void
24-
{
25-
$data = new \SimpleXMLElement($response->getContent(false));
26-
if (0 < $data->Error->count()) {
27-
$data = $data->Error;
28-
}
29-
if (null !== $v = (($v = $data->message) ? (string) $v : null)) {
30-
$this->message = $v;
31-
}
32-
}
3322
}

src/Sts/Exception/RegionDisabledException.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace AsyncAws\Core\Sts\Exception;
44

55
use AsyncAws\Core\Exception\Http\ClientException;
6-
use Symfony\Contracts\HttpClient\ResponseInterface;
76

87
/**
98
* STS is not activated in the requested region for the account that is being asked to generate credentials. The account
@@ -14,14 +13,4 @@
1413
*/
1514
final class RegionDisabledException extends ClientException
1615
{
17-
protected function populateResult(ResponseInterface $response): void
18-
{
19-
$data = new \SimpleXMLElement($response->getContent(false));
20-
if (0 < $data->Error->count()) {
21-
$data = $data->Error;
22-
}
23-
if (null !== $v = (($v = $data->message) ? (string) $v : null)) {
24-
$this->message = $v;
25-
}
26-
}
2716
}

0 commit comments

Comments
 (0)