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
diff --git a/compiler/cpp/src/main.cc b/compiler/cpp/src/main.cc
index 4e8a27a..a6f55f9 100644
--- a/compiler/cpp/src/main.cc
+++ b/compiler/cpp/src/main.cc
@@ -495,8 +495,12 @@
}
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);
}