errors: typed helpers for every documented error type

AlexaErrors has a helper for each of the 73 types of the table on
alexa-errorresponse.html, named after the type in camel case: 63 take the
message only, 10 take the payload fields their page documents. A field the
page requires (reason, currentDeviceMode, currentChargeState, resourceType)
is a required argument, so leaving it out does not compile; from JavaScript
the helper throws a TypeError that lists the values. validRange is optional,
as the page says, and has both ends when given.
temperatureOutOfRange and setpointsTooClose stay as shorter names.
The helpers are compared with the 15 examples of the four error pages.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
David 2026-09-28 21:14:55 +00:00
parent 4a3dd81bcf
commit 94b13f733a
36 changed files with 874 additions and 138 deletions

View file

@ -0,0 +1,19 @@
{
"event": {
"header": {
"namespace": "Alexa",
"name": "ErrorResponse",
"messageId": "Unique identifier, preferably a version 4 UUID",
"correlationToken": "Opaque correlation token that matches the request",
"payloadVersion": "3"
},
"endpoint": {
"endpointId": "Endpoint ID"
},
"payload": {
"type": "ENDPOINT_CONTROL_UNAVAILABLE",
"message": "Device has no connectivity package enabled.",
"reason": "NO_CONNECTIVITY_PACKAGE_ENABLED"
}
}
}

View file

@ -0,0 +1,19 @@
{
"event": {
"header": {
"namespace": "Alexa",
"name": "ErrorResponse",
"messageId": "Unique identifier, preferably a version 4 UUID",
"correlationToken": "Opaque correlation token that matches the request",
"payloadVersion": "3"
},
"endpoint": {
"endpointId": "Endpoint ID"
},
"payload": {
"type": "ENDPOINT_LOW_POWER",
"message": "The lock battery is low",
"percentageState": 5
}
}
}

View file

@ -0,0 +1,19 @@
{
"event": {
"header": {
"namespace": "Alexa",
"name": "ErrorResponse",
"messageId": "Unique identifier, preferably a version 4 UUID",
"correlationToken": "Opaque correlation token that matches the request",
"payloadVersion": "3"
},
"endpoint": {
"endpointId": "Endpoint ID"
},
"payload": {
"type": "NOT_SUPPORTED_IN_CURRENT_MODE",
"message": "The device is in demand response mode.",
"currentDeviceMode": "DEMAND_RESPONSE"
}
}
}

View file

@ -0,0 +1,20 @@
{
"event": {
"header": {
"namespace": "Alexa",
"name": "ErrorResponse",
"messageId": "Unique identifier, preferably a version 4 UUID",
"correlationToken": "Opaque correlation token that matches the request",
"payloadVersion": "3"
},
"endpoint": {
"endpointId": "Endpoint ID"
},
"payload": {
"type": "NOT_SUPPORTED_WITH_CURRENT_BATTERY_CHARGE_STATE ",
"message": "The device has been charging",
"currentChargeState": "ALREADY_CHARGED_TO_REQUIRED_LEVEL",
"currentChargeLevelInPercentage": 75
}
}
}

View file

@ -0,0 +1,28 @@
{
"event": {
"header": {
"namespace": "Alexa",
"name": "ErrorResponse",
"messageId": "Unique identifier, preferably a version 4 UUID",
"correlationToken": "Opaque correlation token that matches the request",
"payloadVersion": "3"
},
"endpoint": {
"endpointId": "Endpoint ID"
},
"payload": {
"type": "TEMPERATURE_VALUE_OUT_OF_RANGE",
"message": "The requested temperature of -15 is out of range.",
"validRange": {
"minimumValue": {
"value": 15,
"scale": "CELSIUS"
},
"maximumValue": {
"value": 30,
"scale": "CELSIUS"
}
}
}
}
}

View file

@ -0,0 +1,22 @@
{
"event": {
"header": {
"namespace": "Alexa",
"name": "ErrorResponse",
"messageId": "Unique identifier, preferably a version 4 UUID",
"correlationToken": "Opaque correlation token that matches the request",
"payloadVersion": "3"
},
"endpoint": {
"endpointId": "Endpoint ID"
},
"payload": {
"type": "VALUE_OUT_OF_RANGE",
"message": "The percent value cannot exceed 100.",
"validRange": {
"minimumValue": 0,
"maximumValue": 100
}
}
}
}

View file

@ -0,0 +1,18 @@
{
"event": {
"header": {
"namespace": "Alexa.Safety",
"name": "ErrorResponse",
"messageId": "Unique identifier, preferably a version 4 UUID",
"correlationToken": "Opaque correlation token that matches the request",
"payloadVersion": "3"
},
"endpoint": {
"endpointId": "Endpoint ID"
},
"payload": {
"type": "OBSTACLE_DETECTED",
"message": "There is an obstacle in the way."
}
}
}

View file

@ -0,0 +1,18 @@
{
"event": {
"header": {
"namespace": "Alexa.Safety",
"name": "ErrorResponse",
"messageId": "Unique identifier, preferably a version 4 UUID",
"correlationToken": "Opaque correlation token that matches the request",
"payloadVersion": "3"
},
"endpoint": {
"endpointId": "Endpoint ID"
},
"payload": {
"type": "SAFETY_BEAM_BREACHED",
"message": "The safety beam was breached."
}
}
}