pmill / aws-cognito

A PHP library for AWS Cognito user pools
MIT License
74 stars 62 forks source link

How to get exception message #20

Closed agung-wete closed 5 years ago

agung-wete commented 5 years ago

got this when doing registerUser

(Uncaught GuzzleHttp\Exception\ClientException: Client error: `POST https://cognito-idp.eu-west-2.amazonaws.com` resulted in a `400 Bad Request` response: {"__type":"InvalidPasswordException","message":"Password did not conform with policy: Password must have lowercase chara (truncated...) )
in ...vendor\pmill\aws-cognito\src\Exception\CognitoResponseException.php on line 28

How to get "message":"Password did not conform with policy: Password must have.... message ?

agung-wete commented 5 years ago

i 'am able to get it via

$e->getPrevious()->getAwsErrorMessage()

bit confusing, because $e->getMessage() shows pmill\AwsCognito\Exception\CognitoResponseException