From f80fa9c1826bd68dc8a9bfd632149e4e7eb433e2 Mon Sep 17 00:00:00 2001 From: Nop0x Date: Mon, 23 Jul 2018 12:52:38 -0400 Subject: [PATCH 1/2] Update core documentation Update the core docs to explain how to handle errors in receive middlewares. Related to https://github.com/howdyai/botkit/pull/1425 --- docs/core.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/core.md b/docs/core.md index 104d182..d054d82 100755 --- a/docs/core.md +++ b/docs/core.md @@ -91,6 +91,21 @@ controller.on('message_received', function(bot, message) { }); ``` +### Middleware error Events + +| Event | Description +|-- |-- +| receive_error | An error happend while processing the message in a recieve middleware. + +Here is an example of a handler for an error event: + +```javascript +controller.on('receive_error', function(err, bot, message) { + bot.reply(message, `There was an error processing your request. + Please try again later. Error: ${err.toString()}`); + }); +``` + ### Conversation Lifecycle Events | Event | Description From c8fd54e9fb123cf675c576567a813004dfe31aec Mon Sep 17 00:00:00 2001 From: Nop0x Date: Mon, 23 Jul 2018 12:55:06 -0400 Subject: [PATCH 2/2] Fix capitalization --- docs/core.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core.md b/docs/core.md index d054d82..1b34632 100755 --- a/docs/core.md +++ b/docs/core.md @@ -91,7 +91,7 @@ controller.on('message_received', function(bot, message) { }); ``` -### Middleware error Events +### Middleware Error Events | Event | Description |-- |--