From 7099238f15a5218f7211c50f000423650c5dad61 Mon Sep 17 00:00:00 2001 From: Jonathan Echavarria Date: Mon, 16 Oct 2017 11:04:13 -0400 Subject: [PATCH 1/3] added error notifications to pushover notification channel --- extensions/notifications/channels/pushover.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extensions/notifications/channels/pushover.rb b/extensions/notifications/channels/pushover.rb index 1e546dbb0..4424d147b 100644 --- a/extensions/notifications/channels/pushover.rb +++ b/extensions/notifications/channels/pushover.rb @@ -13,10 +13,14 @@ module Channels # Configure the Pushover Client client = Rushover::Client.new(@config.get('beef.extension.notifications.pushover.app_key')) - client.notify(@config.get('beef.extension.notifications.pushover.user_key'), message) + res = client.notify(@config.get('beef.extension.notifications.pushover.user_key'), message) + print_error '[Notifications] Pushover notification failed' unless res.ok? + rescue Exception => e + print_error "[Notifications] Pushover notification initalization failed: '#{e.message}'" end end end end end end + From 509d1ac08678df9885748f23b052d791c403022a Mon Sep 17 00:00:00 2001 From: Jonathan Echavarria Date: Mon, 16 Oct 2017 11:10:29 -0400 Subject: [PATCH 2/3] Fixing typo --- extensions/notifications/channels/pushover.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/notifications/channels/pushover.rb b/extensions/notifications/channels/pushover.rb index 4424d147b..b509b8b3f 100644 --- a/extensions/notifications/channels/pushover.rb +++ b/extensions/notifications/channels/pushover.rb @@ -16,7 +16,7 @@ module Channels res = client.notify(@config.get('beef.extension.notifications.pushover.user_key'), message) print_error '[Notifications] Pushover notification failed' unless res.ok? rescue Exception => e - print_error "[Notifications] Pushover notification initalization failed: '#{e.message}'" + print_error "[Notifications] Pushover notification initialization failed: '#{e.message}'" end end end From 3e34834c7812a17bff20070e72d2d18c79b0c834 Mon Sep 17 00:00:00 2001 From: Jonathan Echavarria Date: Mon, 16 Oct 2017 11:19:32 -0400 Subject: [PATCH 3/3] Fixed rescuing Exception --- extensions/notifications/channels/pushover.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/notifications/channels/pushover.rb b/extensions/notifications/channels/pushover.rb index b509b8b3f..50486b596 100644 --- a/extensions/notifications/channels/pushover.rb +++ b/extensions/notifications/channels/pushover.rb @@ -15,7 +15,7 @@ module Channels res = client.notify(@config.get('beef.extension.notifications.pushover.user_key'), message) print_error '[Notifications] Pushover notification failed' unless res.ok? - rescue Exception => e + rescue => e print_error "[Notifications] Pushover notification initialization failed: '#{e.message}'" end end