diff --git a/lib/index.js b/lib/index.js index 0fe3382..7c5d90d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -12,4 +12,11 @@ app.intent('AMAZON.YesIntent', handlers.handleYesIntent); app.intent('AMAZON.NoIntent', handlers.handleNoIntent); app.intent('AMAZON.CancelIntent', handlers.handleCancelIntent); +app.post = function(request, response, type, exception) { + if (exception) { + // Always turn an exception into a successful response + response.clear().say('An error occured: ' + exception).send(); + } +}; + module.exports = app;