From 36216107ec865553ba2fb2e5f8db31f2df537215 Mon Sep 17 00:00:00 2001 From: Matias Fontanini Date: Sat, 26 Dec 2015 07:30:29 -0800 Subject: [PATCH] Catch exceptions on arpmonitor Fixes #119 --- examples/arpmonitor.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/examples/arpmonitor.cpp b/examples/arpmonitor.cpp index 16655ff..97949c9 100644 --- a/examples/arpmonitor.cpp +++ b/examples/arpmonitor.cpp @@ -92,9 +92,14 @@ int main(int argc, char *argv[]) config.set_promisc_mode(true); config.set_filter("arp"); - // Sniff on the provided interface in promiscuous mode - Sniffer sniffer(argv[1], config); - - // Only capture arp packets - monitor.run(sniffer); + try { + // Sniff on the provided interface in promiscuous mode + Sniffer sniffer(argv[1], config); + + // Only capture arp packets + monitor.run(sniffer); + } + catch (std::exception& ex) { + std::cerr << "Error: " << ex.what() << std::endl; + } }