diff --git a/cpp/__init__.py b/cpp/__init__.py index 373cd458..56e1db7a 100644 --- a/cpp/__init__.py +++ b/cpp/__init__.py @@ -40,9 +40,12 @@ def cpp_types_encode(key): try: cpp_type = _cpp_types_encode[key] except KeyError: - cpp_type = _cpp_types_common[key] - if cpp_type == "NA": - raise NotImplementedError("Missing type Mapping for " + key) + try: + cpp_type = _cpp_types_common[key] + except KeyError: + cpp_type = None + if cpp_type is None or cpp_type == "NA": + raise NotImplementedError(f"Missing type Mapping for [{key}]") return cpp_type @@ -50,9 +53,12 @@ def cpp_types_decode(key): try: cpp_type = _cpp_types_decode[key] except KeyError: - cpp_type = _cpp_types_common[key] - if cpp_type == "NA": - raise NotImplementedError("Missing type Mapping for " + key) + try: + cpp_type = _cpp_types_common[key] + except KeyError: + cpp_type = None + if cpp_type is None or cpp_type == "NA": + raise NotImplementedError(f"Missing type Mapping for [{key}]") return cpp_type @@ -60,7 +66,7 @@ def get_size(type): try: size = _type_size[type] except KeyError: - raise NotImplementedError("Missing type size Mapping " + type) + raise NotImplementedError(f"Missing type size Mapping [{type}]") return size @@ -180,7 +186,6 @@ def cpp_escape_keyword(value): "Schema": "serialization::pimpl::schema", "List_Schema": "std::vector", - "Version": "version", } _cpp_types_encode = { diff --git a/cs/__init__.py b/cs/__init__.py index 8fc550bf..d1cd5bc1 100644 --- a/cs/__init__.py +++ b/cs/__init__.py @@ -36,7 +36,6 @@ def cs_types(key, d): try: cs_type = d[key] - cs_type = d[key] except KeyError: try: cs_type = _cs_types_common[key] diff --git a/util.py b/util.py index 1172ba52..8ad83df9 100644 --- a/util.py +++ b/util.py @@ -263,7 +263,8 @@ def generate_codecs(services, custom_services, template, output_dir, lang, env): ) save_file(join(output_dir, codec_file_name), content) except NotImplementedError as e: - print("[%s] contains missing type mapping so ignoring it. Error: %s" % (codec_file_name, e)) + raise NotImplementedError( + f"[{service_name}.{method_name}] codec contains missing type mapping for {lang.value} language. {e}") if lang is SupportedLanguages.CPP: content = get_rendered_text("footer.j2", env) @@ -302,8 +303,8 @@ def generate_custom_codecs(services, template, output_dir, lang, env): content = template.render(codec=codec) save_file(join(output_dir, codec_file_name), content) except NotImplementedError as e: - print("[%s] contains missing type mapping so ignoring it. Error: %s" % (codec_file_name, e)) - + raise NotImplementedError( + f"[{codec['name']}] codec contains missing type mapping for {lang.value} language. {e}") def generate_documentation(services, custom_definitions, template, output_dir): makedirs(output_dir, exist_ok=True)