Skip to content
Snippets Groups Projects
Unverified Commit 9acab553 authored by Marcelo Schmidt's avatar Marcelo Schmidt
Browse files

Add try/catch for avoiding log of error on duplicate messages

parent 435fcef5
No related branches found
No related tags found
No related merge requests found
......@@ -285,7 +285,17 @@ class SlackBridge {
_id: `slack-${message.channel}-${message.ts.replace(/\./g, '-')}`,
ts: new Date(parseInt(message.ts.split('.')[0]) * 1000)
};
this.sendMessage(channel, user, message, msgDataDefaults, importing);
try {
this.sendMessage(channel, user, message, msgDataDefaults, importing);
} catch (e) {
// http://www.mongodb.org/about/contributors/error-codes/
// 11000 == duplicate key error
if (e.name === 'MongoError' && e.code === 11000) {
return;
}
throw e;
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment