diff options
author | Chris Holland <chrisholland3553@gmail.com> | 2020-04-23 20:19:39 -0700 |
---|---|---|
committer | Chris Holland <chrisholland3553@gmail.com> | 2020-04-23 20:19:39 -0700 |
commit | 45126aa4caa9ae9f83ec7d5235ca07c59a4d0747 (patch) | |
tree | 179b82735a71d87d9ce30b2915f2d2bbd33bac62 /numpy/polynomial/polyutils.py | |
parent | bcb036a58aac566d4050b163a0f6b77e09c40123 (diff) | |
download | numpy-45126aa4caa9ae9f83ec7d5235ca07c59a4d0747.tar.gz |
Added some chained exceptions
Diffstat (limited to 'numpy/polynomial/polyutils.py')
-rw-r--r-- | numpy/polynomial/polyutils.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/polynomial/polyutils.py b/numpy/polynomial/polyutils.py index ec7ba6f1d..b1cf07e8a 100644 --- a/numpy/polynomial/polyutils.py +++ b/numpy/polynomial/polyutils.py @@ -193,8 +193,8 @@ def as_series(alist, trim=True): else: try: dtype = np.common_type(*arrays) - except Exception: - raise ValueError("Coefficient arrays have no common type") + except Exception as e: + raise ValueError("Coefficient arrays have no common type") from e ret = [np.array(a, copy=True, dtype=dtype) for a in arrays] return ret @@ -777,7 +777,7 @@ def _deprecate_as_int(x, desc): """ try: return operator.index(x) - except TypeError: + except TypeError as e: # Numpy 1.17.0, 2019-03-11 try: ix = int(x) @@ -793,4 +793,4 @@ def _deprecate_as_int(x, desc): ) return ix - raise TypeError(f"{desc} must be an integer") + raise TypeError(f"{desc} must be an integer") from e |