Description
Describe the issue with documentation
Right now when there is an error calling an API the error object is basically of type any
, and therefore you get zero typing information and help from the IDEs.
Even on the documentation website it's suggesting to do string checks on the error.name
property in order to see what kind of error it is, and then decide accordingly.
This makes it very to properly handle errors, especially when there are several possible failures. For example, in the s3.headObject
operation the failure could be a 404
(name
=NotFound
) or a 403
.
It would be great to have concrete type definitions for TypeScript that is easy to use the error responses, similar to the happy case with XxxCommandInput/Output
types.
Right now basically we have to check the API documentation for each operation used, e.g. API Head Object, to see what errors, or how they will probably be named.
Thanks