chore: use code snippet for signal debugging

Signed-off-by: Heikki Hellgren <heikki.hellgren@op.fi>
This commit is contained in:
Heikki Hellgren
2024-03-08 08:11:56 +02:00
parent 9a41a7bfa8
commit 282f62f490
5 changed files with 19 additions and 39 deletions
+1 -2
View File
@@ -35,8 +35,7 @@ const notificationsDebug = createBackendPlugin({
interval = setInterval(async () => {
await notifications.send({
recipients: {
type: 'entity',
entityRef: 'user:development/guest',
type: 'broadcast',
},
payload: { title: 'Test notification' },
});
@@ -470,7 +470,7 @@ export async function createRouter(
if (!recipients || !title) {
logger.error(`Invalid notification request received`);
throw new InputError();
throw new InputError(`Invalid notification request received`);
}
const origin = credentials.principal.subject;
@@ -496,8 +496,10 @@ export async function createRouter(
try {
users = await getUsersForEntityRef(entityRef);
} catch (e) {
throw new InputError();
logger.error(`Failed to resolve notification receivers: ${e}`);
throw new InputError('Failed to resolve notification receivers', e);
}
const userNotifications = await sendUserNotifications(
baseNotification,
users,