如何在Cognito失败时获取精确的错误信息?

huangapple go评论88阅读模式
英文:

How to obtain exact error on cognito failure

问题

我想知道当Cognito发生内部错误时,我可以在哪里找到确切的错误信息。例如,当我列出用户池的用户时,Cognito返回一个内部错误,我应该在哪里找到返回的确切错误信息。谢谢。

英文:

I was wondering where can I find the exact error that cognito would send when it would have an internal error. For example, I list the users for a pool and cognito returns an internal error, where could I find the exact error that gets returned. Thanks.

答案1

得分: 1

Cognito API 参考文档中,您可以找到返回不同 API 调用的错误列表,以下是以ListUsers为例的错误列表:

InternalErrorException
当 Amazon Cognito 遇到内部错误时,会抛出此异常。
HTTP 状态码:500

InvalidParameterException
当 Amazon Cognito 服务遇到无效参数时,会抛出此异常。
HTTP 状态码:400

NotAuthorizedException
当用户未经授权时,会抛出此异常。
HTTP 状态码:400

ResourceNotFoundException
当 Amazon Cognito 服务无法找到请求的资源时,会抛出此异常。
HTTP 状态码:400

TooManyRequestsException
当用户对于给定操作发出了过多的请求时,会抛出此异常。
HTTP 状态码:400

由于您标记了"Go":如果您正在使用 Go SDK,您将获得一个 awserr.Error 对象,您可以使用其 Code 和 Message 方法来了解返回的错误信息。有关更多信息,请参阅Go SDK 文档

英文:

In the Cognito API Reference you can find a list of errors that are being returned from the different API calls, here is the error list for ListUsers for example:

> InternalErrorException
This exception is thrown when Amazon Cognito encounters an internal error.
HTTP Status Code: 500

> InvalidParameterException
This exception is thrown when the Amazon Cognito service encounters an invalid parameter.
HTTP Status Code: 400

> NotAuthorizedException
This exception is thrown when a user isn't authorized.
HTTP Status Code: 400

> ResourceNotFoundException
This exception is thrown when the Amazon Cognito service can't find the requested resource.
HTTP Status Code: 400

>TooManyRequestsException
This exception is thrown when the user has made too many requests for a given operation.
HTTP Status Code: 400

Since you have tagged "Go": If you are using the Go SDK you get an awserr.Error and you can use its Code and Message methods to learn more about the error that has been returned. See the Go SDK Documentation for more information.

huangapple
  • 本文由 发表于 2022年7月30日 00:10:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/73168160.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定