View Source

# namespace bot.response

## Functions

### checkResponse(responseObj)code »

Checks that a response object does not specify an error as defined by the WebDriver wire protocol. If the response object defines an error, it will be thrown. Otherwise, the response will be returned as is.

Parameters

responseObj`{status: number, value: *}`

  The response object to check.

Returns

`{status: number, value: *}`

  The checked response object.

Throws

`bot.Error`

  If the response describes an error.

### createErrorResponse(error)code »

Converts an error value into its JSON representation as defined by the WebDriver wire protocol.

Parameters

error`*`

  The error value to convert.

Returns

`{status: number, value: *}`

  The new response object.

### createResponse(value)code »

Creates a new success response object with the provided value.

Parameters

value`*`

  The response value.

Returns

`{status: number, value: *}`

  The new response object.

### isResponseObject(value)code »

Parameters

value`*`

  The value to test.

Returns

`boolean`

  Whether the given value is a response object.

## Type Definitions

response.ResponseObject`{status: number, value: *}`

  Type definition for a response object, as defined by the JSON wire protocol.