Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python-experimental] Add support for pep 3134, attach cause of exception #6388

Merged
merged 14 commits into from
May 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
41e97e6
Mustache template should use invokerPackage tag to generate import
sebastien-rosset May 13, 2020
1760f6a
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 13, 2020
3ae466e
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 13, 2020
b628667
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 13, 2020
4dc915c
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 14, 2020
7a207f6
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 16, 2020
776fba6
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 18, 2020
3fac434
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 19, 2020
a96c46b
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 20, 2020
1351fd0
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 21, 2020
88a8915
Add exception cause
sebastien-rosset May 21, 2020
ba65735
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 22, 2020
a60fe58
Merge branch 'master' of github.com:CiscoM31/openapi-generator into p…
sebastien-rosset May 22, 2020
5addcb5
using six module for exception chaining in Python 3.x
sebastien-rosset May 22, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -725,14 +725,14 @@ def deserialize_primitive(data, klass, path_to_item):
# '7' -> 7.0 -> '7.0' != '7'
raise ValueError('This is not a float')
return converted_value
except (OverflowError, ValueError):
except (OverflowError, ValueError) as ex:
# parse can raise OverflowError
raise ApiValueError(
six.raise_from(ApiValueError(
"{0}Failed to parse {1} as {2}".format(
additional_message, repr(data), get_py3_class_name(klass)
),
path_to_item=path_to_item
)
), ex)


def get_discriminator_class(model_class,
Expand Down Expand Up @@ -1220,7 +1220,7 @@ def get_allof_instances(self, model_args, constant_args):
allof_instance = allof_class(**kwargs)
composed_instances.append(allof_instance)
except Exception as ex:
raise ApiValueError(
six.raise_from(ApiValueError(
"Invalid inputs given to generate an instance of '%s'. The "
"input data was invalid for the allOf schema '%s' in the composed "
"schema '%s'. Error=%s" % (
Expand All @@ -1229,7 +1229,7 @@ def get_allof_instances(self, model_args, constant_args):
self.__class__.__name__,
str(ex)
)
)
), ex)
return composed_instances


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -992,14 +992,14 @@ def deserialize_primitive(data, klass, path_to_item):
# '7' -> 7.0 -> '7.0' != '7'
raise ValueError('This is not a float')
return converted_value
except (OverflowError, ValueError):
except (OverflowError, ValueError) as ex:
# parse can raise OverflowError
raise ApiValueError(
six.raise_from(ApiValueError(
"{0}Failed to parse {1} as {2}".format(
additional_message, repr(data), get_py3_class_name(klass)
),
path_to_item=path_to_item
)
), ex)


def get_discriminator_class(model_class,
Expand Down Expand Up @@ -1487,7 +1487,7 @@ def get_allof_instances(self, model_args, constant_args):
allof_instance = allof_class(**kwargs)
composed_instances.append(allof_instance)
except Exception as ex:
raise ApiValueError(
six.raise_from(ApiValueError(
"Invalid inputs given to generate an instance of '%s'. The "
"input data was invalid for the allOf schema '%s' in the composed "
"schema '%s'. Error=%s" % (
Expand All @@ -1496,7 +1496,7 @@ def get_allof_instances(self, model_args, constant_args):
self.__class__.__name__,
str(ex)
)
)
), ex)
return composed_instances


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -992,14 +992,14 @@ def deserialize_primitive(data, klass, path_to_item):
# '7' -> 7.0 -> '7.0' != '7'
raise ValueError('This is not a float')
return converted_value
except (OverflowError, ValueError):
except (OverflowError, ValueError) as ex:
# parse can raise OverflowError
raise ApiValueError(
six.raise_from(ApiValueError(
"{0}Failed to parse {1} as {2}".format(
additional_message, repr(data), get_py3_class_name(klass)
),
path_to_item=path_to_item
)
), ex)


def get_discriminator_class(model_class,
Expand Down Expand Up @@ -1487,7 +1487,7 @@ def get_allof_instances(self, model_args, constant_args):
allof_instance = allof_class(**kwargs)
composed_instances.append(allof_instance)
except Exception as ex:
raise ApiValueError(
six.raise_from(ApiValueError(
"Invalid inputs given to generate an instance of '%s'. The "
"input data was invalid for the allOf schema '%s' in the composed "
"schema '%s'. Error=%s" % (
Expand All @@ -1496,7 +1496,7 @@ def get_allof_instances(self, model_args, constant_args):
self.__class__.__name__,
str(ex)
)
)
), ex)
return composed_instances


Expand Down