Thrift-1696:Compiler fails if namespace of an unknown language is present in the IDL
Patch: Abhishek Kona
print warning instead of throwing an exception
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1389509 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/parse/t_program.h b/compiler/cpp/src/parse/t_program.h
index 0d05eed..60a47d0 100644
--- a/compiler/cpp/src/parse/t_program.h
+++ b/compiler/cpp/src/parse/t_program.h
@@ -182,13 +182,14 @@
it=my_copy.find(base_language);
if (it == my_copy.end()) {
- throw "No generator named '" + base_language + "' could be found!";
- }
-
- if (sub_index != std::string::npos) {
- std::string sub_namespace = language.substr(sub_index+1);
- if(! it->second->is_valid_namespace(sub_namespace)) {
- throw base_language +" generator does not accept '" + sub_namespace + "' as sub-namespace!";
+ std::string warning = "No generator named '" + base_language + "' could be found!";
+ pwarning(1, warning.c_str());
+ } else {
+ if (sub_index != std::string::npos) {
+ std::string sub_namespace = language.substr(sub_index+1);
+ if ( ! it->second->is_valid_namespace(sub_namespace)) {
+ throw base_language + " generator does not accept '" + sub_namespace + "' as sub-namespace!";
+ }
}
}
}