From 346bb0086ea26879d0c77813bb68022e91a4c330 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Wed, 9 Oct 2024 14:40:11 -0400 Subject: [PATCH] Should throw, not return errors, so they land in `catch` --- server/notifications.model.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/notifications.model.js b/server/notifications.model.js index c9adceebb..10e105985 100644 --- a/server/notifications.model.js +++ b/server/notifications.model.js @@ -11,7 +11,7 @@ const NotificationSchema = new mongoose.Schema({ }, { versionKey: false }); NotificationSchema.statics.addNotification = async function(data) { - if(!data.dismissKey) return { message: 'Dismiss key is required!' }; + if(!data.dismissKey) throw { message: 'Dismiss key is required!' }; const defaults = { title : '',