Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Exception #26

Open
fstiehle opened this issue Apr 12, 2019 · 2 comments
Open

Uncaught Exception #26

fstiehle opened this issue Apr 12, 2019 · 2 comments

Comments

@fstiehle
Copy link

fstiehle commented Apr 12, 2019

The AWS SDK, in addition to CognitoIdentityProviderException seems to also throw GuzzleHttp\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

@alielephant
Copy link

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);

@pmill
Copy link
Owner

pmill commented Jun 12, 2019

I'd be happy to accept a pull request for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants