Skip to content

Commit bf5331c

Browse files
authored
Merge pull request #23 from JankariTech/fix-error-message
fix: error logs are reported cumulatively
2 parents 5e192f1 + 475e3e1 commit bf5331c

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

fastlane.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ const pingScrumMasters = (robot, text) => {
154154
typeof parsedBody.events === "undefined" ||
155155
parsedBody.events.length === 0
156156
) {
157-
robot.emit("error", `problem getting scrummaster: '${body}'`)
157+
robot.emit("error", `scrummasters not found: '${body}'`)
158158
return
159159
}
160160
const scrummaster = parsedBody.events[0].title
@@ -167,17 +167,16 @@ const pingScrumMasters = (robot, text) => {
167167
})
168168
}
169169

170-
module.exports = (robot) =>
171-
setInterval(() => {
170+
module.exports = (robot) => {
171+
robot.error(function (err) {
172+
robot.logger.error(err)
173+
robot.send({ room: room }, `Error while running fastlane bot: ${err}`)
174+
})
175+
176+
return setInterval(() => {
172177
endCursor = null
173178
fastlaneCards.length = 0
174-
robot.error(function (err, res) {
175-
robot.logger.error(err)
176-
robot.send(
177-
{ room: room },
178-
`there is an issue with the fastlane bot '${err}'`
179-
)
180-
})
181179

182180
reportFastlaneCards(robot)
183181
}, interval)
182+
}

scrummasters.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ const teamupCalendarKey = 'ks1c2vhnot2ttfvawo'
22
const teamupToken = process.env.HUBOT_TEAMUP_TOKEN
33

44
module.exports = (robot) => {
5-
robot.error(function (err, res) {
5+
robot.error(function (err) {
66
robot.logger.error(err)
7-
res.send(`there is an issue with the fastlane bot '${err}'`)
7+
robot.send(`Error while running scrummaster bot: ${err}`)
88
})
99
robot.hear(/scrum(\s|-)?master(s)?/gi, (res) => {
1010
const dateString = new Date().toISOString().slice(0, 10)
@@ -23,7 +23,7 @@ module.exports = (robot) => {
2323
return
2424
}
2525
if (typeof parsedBody.events === 'undefined' || parsedBody.events.length === 0) {
26-
robot.emit('error', `problem getting scrummaster: '${body}'`, res)
26+
robot.emit('error', `scrummasters not found: '${body}'`)
2727
return
2828
}
2929
const scrummaster = parsedBody.events[0].title

0 commit comments

Comments
 (0)