|
|
@@ -79,14 +79,19 @@ module.exports = function(crowi, app) {
|
|
|
|
|
|
// slack notification
|
|
|
if (slackNotificationForm.isNotification) {
|
|
|
- const slackNotify = new slack(crowi);
|
|
|
- const user = await User.findUserByUsername(req.user.username);
|
|
|
- const path = page.path;
|
|
|
- const channels = slackNotificationForm.notifSlackChannel;
|
|
|
-
|
|
|
- channels.split(',').map(function(chan) {
|
|
|
- slackNotify.postComment(createdComment, user, chan, path);
|
|
|
- });
|
|
|
+ try {
|
|
|
+ const slackNotify = new slack(crowi);
|
|
|
+ const user = await User.findUserByUsername(req.user.username);
|
|
|
+ const path = page.path;
|
|
|
+ const channels = slackNotificationForm.notifSlackChannel;
|
|
|
+
|
|
|
+ channels.split(',').map(function(chan) {
|
|
|
+ slackNotify.postComment(createdComment, user, chan, path);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ catch (err) {
|
|
|
+ console.log('error occured in sending slack notification: ', err);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return res.json(ApiResponse.success({comment: createdComment}));
|