Skip to content

Commit 7bf1cc7

Browse files
authored
provide more context to errors (#92)
* reverse the order of checks in the DimensionalityError constructor * simplify the str method * add a custom exception for invalid units * use the new exception to present all invalid units at once * replace the custom class by a formatter * use the new formatter to collect and present unit errors * fix a leftover reference to the custom error class * synchronize DataArray quantify with Dataset quantify * more removing of the custom error classes * fix a bug in reindex and rely on convert_units to raise an error * fix most other methods * update whats-new.rst * fix a link [skip-ci] * explicitly parse the units * limit the errors caught in quantify to ValueError and UndefinedUnitError * remove the custom error class * actually call loc when expecting errors * also check whether the error for a invalid attribute is properly formatted * rewrite the tests for to
1 parent 91ef50d commit 7bf1cc7

File tree

6 files changed

+447
-545
lines changed

6 files changed

+447
-545
lines changed

docs/whats-new.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ What's new
88
- rewrite :py:meth:`Dataset.pint.quantify` and :py:meth:`DataArray.pint.quantify`,
99
to use pint's `parse_units` instead of `parse_expression` (:pull:`40`)
1010
By `Tom Nicholas <https://github.com/TomNicholas>`_.
11-
- ensure the variable which causes the error is explicit if an error occurs in
12-
:py:meth:`Dataset.pint.quantify` (:pull:`43`)
13-
By `Tom Nicholas <https://github.com/TomNicholas>`_.
11+
- ensure the variables which causes the error is explicit if an error occurs in
12+
:py:meth:`Dataset.pint.quantify` and other methods (:pull:`43`, :pull:`91`)
13+
By `Tom Nicholas <https://github.com/TomNicholas>`_ and `Justus Magin <https://github.com/keewis>`_.
1414
- refactor the internal conversion functions (:pull:`56`)
1515
By `Justus Magin <https://github.com/keewis>`_.
1616
- allow converting indexes (except :py:class:`pandas.MultiIndex`) (:pull:`56`)
@@ -45,7 +45,7 @@ What's new
4545
By `Justus Magin <https://github.com/keewis>`_.
4646
- implement :py:meth:`Dataset.pint.interpolate_na` and :py:meth:`DataArray.pint.interpolate_na` (:pull:`82`).
4747
By `Justus Magin <https://github.com/keewis>`_.
48-
- expose :py:func:`pint_xarray.accessors.setup_registry` as public API (:pull:`89`)
48+
- expose :py:func:`pint_xarray.setup_registry` as public API (:pull:`89`)
4949
By `Justus Magin <https://github.com/keewis>`_.
5050

5151
v0.1 (October 26 2020)

0 commit comments

Comments
 (0)