How can I get programmatic error codes from Cognito mode

0 votes

I'm using the Cognito Javascript SDK and created a form where a user can register an Account. If for any reason, server-side validation fails, the response to it is like below:

{
  "__type":"InvalidParameterException",
  "message":"4 validation errors detected: Value at 'password' failed to satisfy constraint: Member must have length greater than or equal to 6; Value at 'password' failed to satisfy constraint: Member must satisfy regular expression pattern: [\\S]+; Value at 'username' failed to satisfy constraint: Member must have length greater than or equal to 1; Value at 'username' failed to satisfy constraint: Member must satisfy regular expression pattern: [\\p{L}\\p{M}\\p{S}\\p{N}\\p{P}]+"
}

The issue with the response is that I cannot provide a good user feedback because I'd have to parse the response to determine which fields need to be fixed. Is there any way to get the errors back in a format which is better for working in a programmatic manner?

Jun 9, 2018 in AWS by DragonLord999
• 8,450 points
3,739 views

1 answer to this question.

0 votes
The best way to do this is to grab the values programmatically by cutting the substrings out after 'value at'.

I didn't get an example of the libraries that might help in fixing or even doing this but this is good feedback though.
answered Jun 9, 2018 by Cloud gunner
• 4,670 points

Related Questions In AWS

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How can i copy tables from one database to other on AWS?

You can use AWS Data pipeline to ...READ MORE

answered Jul 5, 2018 in AWS by Priyaj
• 58,020 points
4,787 views
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,020 points
2,714 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,034 views
0 votes
1 answer

How can I return XML from boto calls?

I don't think there's an officially supported ...READ MORE

answered Jul 20, 2018 in AWS by Cloud gunner
• 4,670 points
1,458 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP