Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Handle service client responses - AWS SDK for JavaScript

The AWS SDK for JavaScript V3 API Reference Guide describes in detail all the API operations for the AWS SDK for JavaScript version 3 (V3).

The AWS SDK for JavaScript V3 API Reference Guide describes in detail all the API operations for the AWS SDK for JavaScript version 3 (V3).

Handle service client responses

After a service client method has been called, it returns a response object instance of an interface with the name associated with the client method. For example, if you use the AbcCommand client method, the response object is of AbcResponse (interface) type.

Access data returned in the response

The response object contains the data, as properties, returned by the service request.

In Create service client requests, the ListTablesCommand command returned the table names in the TableNames property of the response.

Access error information

If a command fails, it throws an exception. The following code snippet shows a way of handling a service exception.

try { await client.send(someCommand); } catch (e) { if (e.name === "InvalidSignatureException") { // Handle InvalidSignatureException } else if (e.name === "ResourceNotFoundException") { // Handle ResourceNotFoundException } else if (e.name === "FooServiceException") { // Handle all other server-side exceptions from Foo service } else { // Handle errors from SDK } }
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.