AWS.Response — AWS SDK for JavaScript (original) (raw)

We recommend that you migrate to AWS SDK for JavaScript v3. For dates, additional details, and information on how to migrate, please refer to the linked announcement.

Class: AWS.Response

Inherits:

Object

Defined in:

lib/response.js

Overview

This class encapsulates the response information from a service request operation sent through AWS.Request. The response object has two main properties for getting information back from a request:

The data property

The response.data property contains the serialized object data retrieved from the service request. For instance, for an Amazon DynamoDB listTables method call, the response data might look like:

> resp.data
{ TableNames:
   [ 'table1', 'table2', ... ] }

The data property can be null if an error occurs (see below).

The error property

In the event of a service error (or transfer error), theresponse.error property will be filled with the given error data in the form:

{ code: 'SHORT_UNIQUE_ERROR_CODE',
  message: 'Some human readable error message' }

In the case of an error, the data property will be null. Note that if you handle events that can be in a failure state, you should always check whether response.error is set before attempting to access the response.data property.

Data Propertiescollapse

Operation Propertiescollapse

HTTP Propertiescollapse

HTTP Propertiescollapse

Property Details

data ⇒ Object

Note:

Inside of a AWS.Request~httpData event, this property contains a single raw packet instead of the full de-serialized service response.

Returns the de-serialized response data from the service.

error ⇒ Error

Note:

This attribute is only filled if a service or networking error occurs.

An structure containing information about a service or networking error.

httpResponseAWS.HttpResponse

Returns the raw HTTP response object containing the response headers and body information from the server.

redirectCount ⇒ Integer

Returns the number of redirects that were followed before the request was completed.

requestId ⇒ String

Returns the unique request ID associated with the response. Log this value when debugging requests for AWS support.

retryCount ⇒ Integer

Returns the number of retries that were attempted before the request was completed.

Method Details

hasNextPage() ⇒ Boolean

Returns whether more pages of data can be returned by further requests.

nextPage(callback) ⇒ AWS.Request?

Creates a new request for the next page of response data, calling the callback with the page data if a callback is provided.