【发布时间】:2017-10-12 23:02:51
【问题描述】:
我正在使用 Cognito Javscript SDK,并且我创建了一个表单,用户可以在其中注册帐户。如果由于某种原因,服务器端验证失败,则响应如下所示:
{
"__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}]+"
}
此响应的问题在于我无法提供良好的用户反馈,因为我必须解析响应以确定需要修复哪些字段。有没有办法以更适合以编程方式处理的格式恢复错误?
【问题讨论】:
标签: amazon-web-services aws-sdk amazon-cognito aws-cognito