Log Pushover response status code

Update title
This commit is contained in:
Mark van Renswoude 2021-08-18 18:43:26 +02:00
parent e8bcf6c9e6
commit 67909bc71a
3 changed files with 6 additions and 3 deletions

View File

@ -130,7 +130,7 @@ class NotificationFacade
try
{
this.logger.info(`Sending notification '${notification.id}' with token '${notification.token}' to '${contact.description}' (attempt ${attempt})`);
await transport.send(contact, notification);
await transport.send(this.logger, contact, notification);
this.logger.info(`Notification '${notification.id}' succesfully sent to '${contact.description}'`);
return;

View File

@ -69,6 +69,7 @@ class NotificationRepository
}
this.logger.info(`Latching notification with id ${id} and token '${token}', send permitted`);
notification.title = title;
notification.latched = true;
notification.latchTime = now;
notification.reminders = true;

View File

@ -3,7 +3,7 @@ const axios = require('axios');
class PushoverTransport
{
async send(contact, notification)
async send(logger, contact, notification)
{
try
{
@ -21,7 +21,9 @@ class PushoverTransport
data.sound = notification.sound;
const response = await axios.post("https://api.pushover.net/1/messages.json", data);
return response.statu;
logger.verbose(`Pushover API returned status code ${response.status}`);
return response.status === 200;
}
catch
{