From 877237abcf93e7bd7bc9a7d095d3a850c309817e Mon Sep 17 00:00:00 2001 From: David Reiss Date: Fri, 27 Jul 2007 00:40:19 +0000 Subject: [PATCH] Thrift: Catch what you throw. Summary: Catch an exception that was being thrown, and print out the error message. Trac Bug: # Blame Rev: Reviewed By: mcslee Test Plan: Recompiled Thrift. Ran it on a broken .thrift that throws one of these exceptions. Revert Plan: ok Notes: EImportant: git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665177 13f79535-47bb-0310-9956-ffa450edef68 --- compiler/cpp/src/main.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/cpp/src/main.cc b/compiler/cpp/src/main.cc index 4e8a27aa..a6f55f98 100644 --- a/compiler/cpp/src/main.cc +++ b/compiler/cpp/src/main.cc @@ -495,8 +495,12 @@ void parse(t_program* program, t_program* parent_program) { } pverbose("Parsing %s for types\n", path.c_str()); yylineno = 1; - if (yyparse() != 0) { - failure("Parser error during types pass."); + try { + if (yyparse() != 0) { + failure("Parser error during types pass."); + } + } catch (string x) { + failure(x.c_str()); } fclose(yyin); } -- 2.17.1