summaryrefslogtreecommitdiff
path: root/lib/fake_agent.rb
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2015-02-09 20:36:18 -0700
committermo khan <mo@mokhan.ca>2015-02-09 20:36:18 -0700
commit41c8858025eb14cab34635b058ccf761dd04eb90 (patch)
tree092eebd37ce516b81b248507e82ead59dc63a07b /lib/fake_agent.rb
parent34f53efff788b7558f63d973aad1f3475c27c125 (diff)
use api controller and log errors in fake agent.
Diffstat (limited to 'lib/fake_agent.rb')
-rw-r--r--lib/fake_agent.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/fake_agent.rb b/lib/fake_agent.rb
index ecc9e47..2cf3309 100644
--- a/lib/fake_agent.rb
+++ b/lib/fake_agent.rb
@@ -44,6 +44,8 @@ class FakeAgent
when "unknown"
puts "file is unknown"
end
+ rescue StandardError => error
+ log_error(error)
end
def sniff(interface)
@@ -85,8 +87,8 @@ class FakeAgent
}
Typhoeus.post(event_url, body: body)
end
- rescue => e
- puts "#{e.message} #{e.backtrace.join(' ')}"
+ rescue StandardError => error
+ log_error(error)
end
def fingerprint_for(file)
@@ -122,4 +124,8 @@ class FakeAgent
def registration_url
"#{endpoint}/api/agents"
end
+
+ def log_error(error)
+ puts "#{error.message} #{error.backtrace.join(' ')}"
+ end
end