From eeae9a0762c6fdb1714ae886f0d80861906ec476 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Mon, 16 Sep 2002 11:55:23 +0000 Subject: [PATCH] Added try catch block to catch runtime errors thrown from matching algorithms [SVN r15374] --- example/jgrep/jgrep.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/example/jgrep/jgrep.cpp b/example/jgrep/jgrep.cpp index 5cc4207c..0c0a6b8f 100644 --- a/example/jgrep/jgrep.cpp +++ b/example/jgrep/jgrep.cpp @@ -90,6 +90,7 @@ bool ogrep_predicate::operator()(const boost::match_results void process_grep(const char* file) { + try{ using namespace boost; mapfile f(file); unsigned int count = 0; @@ -118,6 +119,14 @@ void process_grep(const char* file) cout << "File " << file << "(" << f.size() << "bytes):" << endl << "0 lines match" << endl; } } + } + catch(const std::exception& e) + { + std::cerr << std::endl << e.what() << std::endl; + } + catch(...) + { + } }