Skip to content

Commit 934f2dd

Browse files
authored
Avoid overriding the exception message with the raw message (#1516)
1 parent 83ee0a7 commit 934f2dd

8 files changed

+0
-60
lines changed

src/Exception/DetectedLanguageLowConfidenceException.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ protected function populateResult(ResponseInterface $response): void
3030
{
3131
$data = $response->toArray(false);
3232

33-
if (null !== $v = (isset($data['message']) ? (string) $data['message'] : null)) {
34-
$this->message = $v;
35-
}
3633
$this->detectedLanguageCode = isset($data['DetectedLanguageCode']) ? (string) $data['DetectedLanguageCode'] : null;
3734
}
3835
}

src/Exception/InternalServerException.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,10 @@
33
namespace AsyncAws\Translate\Exception;
44

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

87
/**
98
* An internal server error occurred. Retry your request.
109
*/
1110
final class InternalServerException extends ClientException
1211
{
13-
protected function populateResult(ResponseInterface $response): void
14-
{
15-
$data = $response->toArray(false);
16-
17-
if (null !== $v = (isset($data['message']) ? (string) $data['message'] : null)) {
18-
$this->message = $v;
19-
}
20-
}
2112
}

src/Exception/InvalidRequestException.php

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

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

87
/**
98
* The request that you made is not valid. Check your request to determine why it's not valid and then retry the
109
* request.
1110
*/
1211
final class InvalidRequestException extends ClientException
1312
{
14-
protected function populateResult(ResponseInterface $response): void
15-
{
16-
$data = $response->toArray(false);
17-
18-
if (null !== $v = (isset($data['message']) ? (string) $data['message'] : null)) {
19-
$this->message = $v;
20-
}
21-
}
2213
}

src/Exception/ResourceNotFoundException.php

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

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

87
/**
98
* The resource you are looking for has not been found. Review the resource you're looking for and see if a different
109
* resource will accomplish your needs before retrying the revised request.
1110
*/
1211
final class ResourceNotFoundException extends ClientException
1312
{
14-
protected function populateResult(ResponseInterface $response): void
15-
{
16-
$data = $response->toArray(false);
17-
18-
if (null !== $v = (isset($data['message']) ? (string) $data['message'] : null)) {
19-
$this->message = $v;
20-
}
21-
}
2213
}

src/Exception/ServiceUnavailableException.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,10 @@
33
namespace AsyncAws\Translate\Exception;
44

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

87
/**
98
* The Amazon Translate service is temporarily unavailable. Wait a bit and then retry your request.
109
*/
1110
final class ServiceUnavailableException extends ClientException
1211
{
13-
protected function populateResult(ResponseInterface $response): void
14-
{
15-
$data = $response->toArray(false);
16-
17-
if (null !== $v = (isset($data['message']) ? (string) $data['message'] : null)) {
18-
$this->message = $v;
19-
}
20-
}
2112
}

src/Exception/TextSizeLimitExceededException.php

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

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

87
/**
98
* The size of the text you submitted exceeds the size limit. Reduce the size of the text or use a smaller document and
109
* then retry your request.
1110
*/
1211
final class TextSizeLimitExceededException extends ClientException
1312
{
14-
protected function populateResult(ResponseInterface $response): void
15-
{
16-
$data = $response->toArray(false);
17-
18-
if (null !== $v = (isset($data['message']) ? (string) $data['message'] : null)) {
19-
$this->message = $v;
20-
}
21-
}
2213
}

src/Exception/TooManyRequestsException.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,10 @@
33
namespace AsyncAws\Translate\Exception;
44

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

87
/**
98
* You have made too many requests within a short period of time. Wait for a short time and then try your request again.
109
*/
1110
final class TooManyRequestsException extends ClientException
1211
{
13-
protected function populateResult(ResponseInterface $response): void
14-
{
15-
$data = $response->toArray(false);
16-
17-
if (null !== $v = (isset($data['message']) ? (string) $data['message'] : null)) {
18-
$this->message = $v;
19-
}
20-
}
2112
}

src/Exception/UnsupportedLanguagePairException.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ protected function populateResult(ResponseInterface $response): void
4141
{
4242
$data = $response->toArray(false);
4343

44-
if (null !== $v = (isset($data['message']) ? (string) $data['message'] : null)) {
45-
$this->message = $v;
46-
}
4744
$this->sourceLanguageCode = isset($data['SourceLanguageCode']) ? (string) $data['SourceLanguageCode'] : null;
4845
$this->targetLanguageCode = isset($data['TargetLanguageCode']) ? (string) $data['TargetLanguageCode'] : null;
4946
}

0 commit comments

Comments
 (0)