diff options
author | Ram Rachum <ram@rachum.com> | 2020-06-12 13:00:58 +0300 |
---|---|---|
committer | Bryce Guinta <bryce.guinta@protonmail.com> | 2020-06-19 21:07:10 -0400 |
commit | 92f556842c84a2b3cc33a1638fc625b4f67d0d1f (patch) | |
tree | 8302a34cb9713564bc2dbcc7662d02d3f1398e7f | |
parent | 66df7641a8ebce0da8b0023b7053b1c53e916372 (diff) | |
download | astroid-git-92f556842c84a2b3cc33a1638fc625b4f67d0d1f.tar.gz |
Fix exception causes in helpers.py
-rw-r--r-- | astroid/helpers.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/astroid/helpers.py b/astroid/helpers.py index 1c84651d..8ab68799 100644 --- a/astroid/helpers.py +++ b/astroid/helpers.py @@ -190,9 +190,9 @@ def _type_check(type1, type2): return False try: return type1 in type2.mro()[:-1] - except exceptions.MroError: + except exceptions.MroError as e: # The MRO is invalid. - raise exceptions._NonDeducibleTypeHierarchy + raise exceptions._NonDeducibleTypeHierarchy from e def is_subtype(type1, type2): @@ -261,10 +261,10 @@ def object_len(node, context=None): try: len_call = next(node_type.igetattr("__len__", context=context)) - except exceptions.AttributeInferenceError: + except exceptions.AttributeInferenceError as e: raise exceptions.AstroidTypeError( "object of type '{}' has no len()".format(node_type.pytype()) - ) + ) from e result_of_len = next(len_call.infer_call_result(node, context)) if ( |