Ti ringraziamo per la visita. Questa pagina è per il momento disponibile solo in inglese.

Alexa.Health.ErrorResponse Interface

If Alexa sends an Alexa.Health directive to your skill and you can't handle it successfully, respond with an Alexa.Health.ErrorResponse event. For an overview of the Alexa.Health interfaces, see Understand the Baby Activity Skill API.

Error response event

In the payload for the Alexa.Health.ErrorResponse, specify the type of the error and include a message with information about the error. For the list of Alexa.Health error types, see Error type values.

ErrorResponse event payload details

Field Description Type Required
type The type of error. String Yes
message The error message for the error. String Yes

ErrorResponse event format

{
"event": {
    "header": {
      "namespace": "Alexa.Health",
      "name": "ErrorResponse",
      "messageId": "<message id>",
      "payloadVersion": "1"
    },
    "payload": {
      "type": "<error type>",
      "message": "<error message>"
    }
  }
}

Error type values

The following table shows the valid Alexa.Health error types.

Type Description Notes
CONTENT_NOT_SUPPORTED Indicates that the skill is doesn't support the value that the customer is trying to record.
INVALID_NEXT_TOKEN Indicates that a token used to get results in a query is not valid. For more information, see Paginating Results.
TIMER_ALREADY_PAUSED Indicates that a timer is already paused when you attempt to pause or it.
TIMER_ALREADY_RUNNING Indicates that a timer is already running when you attempt to start or resume it. Include the elapsed time of the timer in the payload. Alexa uses the elapsed time to automatically stop a forgotten timer. The field is named elapsedTime and the value is a duration string.
TIMER_NOT_PAUSED Indicates that a timer is not paused when you attempt to resume it.
TIMER_NOT_RUNNING Indicates that a timer is not running when you attempt to stop, cancel, or pause it.

In addition to the Alexa.Health error types, you can also use Alexa error types. For more information, see Alexa.ErrorResponse error type values.

The following list shows the Alexa error types that you can use in an Alexa.Health.ErrorResponse event:

  • EXPIRED_AUTHORIZATION_CREDENTIAL
  • INTERNAL_ERROR
  • INVALID_AUTHORIZATION_CREDENTIAL
  • INVALID_DIRECTIVE
  • INVALID_VALUE
  • NOT_IN_OPERATION
  • NOT_SUPPORTED_IN_CURRENT_MODE
  • RATE_LIMIT_EXCEEDED
  • VALUE_OUT_OF_RANGE

Examples

The following example shows the error response when the customer attempts to start or resume a timer that is already running.

Timer already running example

{
"event": {
    "header": {
      "namespace": "Alexa.Health",
      "name": "ErrorResponse",
      "messageId": "<message id>",
      "payloadVersion": "1"
    },
    "payload": {
      "type": "TIMER_ALREADY_RUNNING",
      "message": "There is already a timer running.",
      "elapsedTime": "PT3H15M"
    }
  }
}

The following example shows the error response when the customer attempts to add a weight that is out of range.

Value out of range example

{
"event": {
    "header": {
      "namespace": "Alexa.Health",
      "name": "ErrorResponse",
      "messageId": "<message id>",
      "payloadVersion": "1"
    },
    "payload": {
      "type": "VALUE_OUT_OF_RANGE",
      "message": "Weight must be between 0 and 500 kilograms, or between 0 and 1,000 pounds."
    }
  }
}
Interface Description
Alexa.ErrorResponse Defines general errors for Alexa skills.