in source/lambda/services/slacknotify/lib/slack-notify.js [213:235]
processEvent(slackURL, slackMssg, cb) {
const _self = this;
_self.postMessage(slackURL, slackMssg, response => {
if (response.statusCode < 400) {
return cb(null, 'Message posted successfully');
} else if (response.statusCode < 500) {
LOGGER.log(
'WARN',
`Error posting message to Slack API: ${response.statusCode} - ${
response.statusMessage
}`
);
return cb(response.statusMessage, null); // Don't retry because the error is due to a problem with the request
} else {
// Let Lambda retry
return cb(
`Server error when processing message: ${response.statusCode} - ${
response.statusMessage
}`
);
}
});
}