From b8dfaeb31e8df539b5ad0ca1af9b454fde231c32 Mon Sep 17 00:00:00 2001 From: Stephen Yeargin Date: Wed, 3 Apr 2024 19:45:25 -0500 Subject: [PATCH] Check for empty match on incident lookup --- src/scripts/pagerduty.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/scripts/pagerduty.js b/src/scripts/pagerduty.js index 09ecad1..dcc83fb 100644 --- a/src/scripts/pagerduty.js +++ b/src/scripts/pagerduty.js @@ -105,6 +105,12 @@ module.exports = function (robot) { return; } + if (!incident || !incident['incident']) { + logger.debug(incident); + msg.send('No matching incident found for `msg.match[3]`.'); + return; + } + msg.send(formatIncident(incident['incident'])); }); });