Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions cpp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,33 @@ 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


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


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


Expand Down Expand Up @@ -180,7 +186,6 @@ def cpp_escape_keyword(value):

"Schema": "serialization::pimpl::schema",
"List_Schema": "std::vector<serialization::pimpl::schema>",
"Version": "version",
}

_cpp_types_encode = {
Expand Down
1 change: 0 additions & 1 deletion cs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
7 changes: 4 additions & 3 deletions util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Loading