From ffb031d74ea3dbcfe271bd098fbe8642f57f7e69 Mon Sep 17 00:00:00 2001 From: Henrique Mendonca Date: Mon, 24 Sep 2012 18:36:16 +0000 Subject: [PATCH] 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 --- compiler/cpp/src/parse/t_program.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/compiler/cpp/src/parse/t_program.h b/compiler/cpp/src/parse/t_program.h index 0d05eede..60a47d04 100644 --- a/compiler/cpp/src/parse/t_program.h +++ b/compiler/cpp/src/parse/t_program.h @@ -182,13 +182,14 @@ class t_program : public t_doc { 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!"; + } } } } -- 2.17.1