Class: AWS.Response
- Inherits:
-
Object
- Object
- AWS.Response
- 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), the
response.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 Properties collapse
-
data ⇒ Object
readonly
The de-serialized response data from the service.
-
error ⇒ Error
readonly
An structure containing information about a service or networking error.
-
requestId ⇒ String
readonly
The unique request ID associated with the response.
Operation Properties collapse
-
redirectCount ⇒ Integer
readonly
The number of redirects that were followed before the request was completed.
-
retryCount ⇒ Integer
readonly
The number of retries that were attempted before the request was completed.
HTTP Properties collapse
-
httpResponse ⇒ AWS.HttpResponse
readonly
The raw HTTP response object containing the response headers and body information from the server.
HTTP Properties collapse
-
hasNextPage() ⇒ Boolean
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.
Property Details
data ⇒ Object (readonly)
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 (readonly)
This attribute is only filled if a service or networking error occurs.
An structure containing information about a service or networking error.
httpResponse ⇒ AWS.HttpResponse (readonly)
Returns the raw HTTP response object containing the response headers and body information from the server.
redirectCount ⇒ Integer (readonly)
Returns the number of redirects that were followed before the request was completed.
requestId ⇒ String (readonly)
Returns the unique request ID associated with the response. Log this value when debugging requests for AWS support.
retryCount ⇒ Integer (readonly)
Returns the number of retries that were attempted before the request was completed.