Unable to test for system exceptions in requests
JoshTumath opened this issue · 0 comments
JoshTumath commented
While creating our Alexa skill, our team noticed that, if we forget to emit :responseReady
when starting to play something in the audio player, the Alexa device will call a the Unhandled
handler with the following request (see docs):
{ type: "System.ExceptionEncountered",
requestId: "amzn1.echo-api.request.170b9121-04e5-4794-826d-1c00f51dcc8c",
timestamp: "2017-10-02T11:01:02Z",
locale: "en-GB",
error:
{ type: "INVALID_RESPONSE",
message: "An exception occurred while dispatching the request to the skill." },
cause: { requestId: "amzn1.echo-api.request.cf8066e8-c7d8-4324-be51-f3c0d1ff9709" } }
So we changed our Unhandled
handler to look a bit like this:
Unhandled() {
if (this.event.request.type === 'System.ExceptionEncountered') {
// Log the system exception...
}
this.emit(':tell', 'Sorry, there was an error.');
}
We would like to test how we handle system exceptions in our skill. However, as far as I know, there is no way within the testing framework to simulate an error in the request.