Open fstiehle opened 5 years ago
Facing the same issue, I cant catch the exception. CognitoClient Class need to return the issue instead of throwing an exception : throw CognitoResponseException::createFromCognitoException($e);
I'd be happy to accept a pull request for this.
The AWS SDK, in addition to
CognitoIdentityProviderException
seems to also throwGuzzleHttp\Exception\ClientException
.public function registerUser()
for example throws this for{"__type":"UsernameExistsException","message":"User already exists"}
(See error snippet below).This doesn't get caught and mapped to the pmill\AwsCognito\Exception's. Making the error handling significantly harder for the caller method.
(Related #20?)
Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: `POST https://cognito-idp.us-east-1.amazonaws.com` resulted in a `400 Bad Request` response: {"__type":"UsernameExistsException","message":"User already exists"} in /app/public/.../vendor/pmill/aws-cognito/src/Exception/CognitoResponseException.php on line 28