# Namespace bot.response

code »
Show:Public Protected Private

## Type Definitions

code »bot.response.ResponseObject : `{status: bot.ErrorCode, value: (*|{message: string})}`
Type definition for a response object, as defined by the JSON wire protocol.

## Global Functions

code »bot.response.checkResponse ( responseObj ) ⇒ `!bot.response.ResponseObject`

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: `!bot.response.ResponseObject` The response object to check.
Returns
The checked response object.
Throws
`bot.Error` If the response describes an error.

code »bot.response.createErrorResponse ( error ) ⇒ `!bot.response.ResponseObject`

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

Parameters
error: `(bot.Error|Error|*)` The error value to convert.
Returns
The new response object.

code »bot.response.createResponse ( value ) ⇒ `!bot.response.ResponseObject`

Creates a new success response object with the provided value.

Parameters
value: `*` The response value.
Returns
The new response object.

code »bot.response.isResponseObject ( value ) ⇒ `boolean`

Parameters
value: `*` The value to test.
Returns
Whether the given value is a response object.