From 3c3fe08f9953ada627f86e3aaf3d19aa4a1a2dc4 Mon Sep 17 00:00:00 2001 From: ilor <kailoran@gmail.com> Date: Tue, 15 Feb 2011 16:23:56 +0100 Subject: [PATCH] handle ANTLR exceptions gracefully in rule data tests --- tests/datarule.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/datarule.cpp b/tests/datarule.cpp index 83d2b48..ac00881 100644 --- a/tests/datarule.cpp +++ b/tests/datarule.cpp @@ -1,5 +1,7 @@ #include "datadriven.h" +#include <antlr/RecognitionException.hpp> + #include <libpwrutils/util.h> #include <libpwrutils/foreach.h> #include <libpwrutils/pathsearch.h> @@ -199,6 +201,13 @@ void test_one_rule_item(const rule_compare_test& c) test_one_rule_item_actual(c); } catch (PwrNlp::PwrNlpError& e) { BOOST_ERROR("Caught " << e.scope() << " exception: \n" << e.info()); + } catch (antlr::RecognitionException &e) { + BOOST_ERROR("Caught " << "ANTLR" << " exception: \n" + << e.getFileLineColumnString() + << " " << e.getMessage()); + } catch (antlr::ANTLRException &e) { + BOOST_ERROR("Caught " << "ANTLR" << " exception: \n" + << " " << e.getMessage()); } } -- GitLab