Thrift: Catch what you throw.
authorDavid Reiss <dreiss@apache.org>
Fri, 27 Jul 2007 00:40:19 +0000 (00:40 +0000)
committerDavid Reiss <dreiss@apache.org>
Fri, 27 Jul 2007 00:40:19 +0000 (00:40 +0000)
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

index 4e8a27a..a6f55f9 100644 (file)
@@ -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);
 }