We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 56b6d62 commit 6b477acCopy full SHA for 6b477ac
srv/service.js
@@ -1,5 +1,6 @@
1
-const { buildNotification } = require("./../lib/utils")
+const { buildNotification, messages } = require("./../lib/utils")
2
const cds = require('@sap/cds')
3
+const LOG = cds.log('notifications');
4
5
class NotificationService extends cds.Service {
6
@@ -9,6 +10,10 @@ class NotificationService extends cds.Service {
9
10
* @param {object} message - The message object
11
*/
12
emit (event, message) {
13
+ if(!event) {
14
+ LOG._warn && LOG.warn(messages.NO_OBJECT_FOR_NOTIFY);
15
+ return;
16
+ }
17
// Outbox calls us with a req object, e.g. { event, data, headers }
18
if (event.event) return super.emit (event)
19
// First argument is optional for convenience
0 commit comments