8000 Provide exception message and change exception type · matplotlib/matplotlib@911632a · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 911632a

committed
Provide exception message and change exception type
1 parent 535c953 commit 911632a

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Specified exception types in Grid
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
In a few cases an `Exception` was thrown when an incorrect argument value
5+
was set in the `mpl_toolkits.axes_grid1.axes_grid.Grid`
6+
(= `mpl_toolkits.axisartist.axes_grid.Grid`) constructor. These are replaced
7+
as follows:
8+
9+
* Providing an incorrect value for *ngrids* now raises a `ValueError`
10+
* Providing an incorrect type for *rect* now raises a `TypeError`

lib/mpl_toolkits/axes_grid1/axes_grid.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ def __init__(self, fig,
123123
ngrids = self._nrows * self._ncols
124124
else:
125125
if not 0 < ngrids <= self._nrows * self._ncols:
126-
raise Exception("")
126+
raise ValueError(
127+
"ngrids must be positive and not larger than nrows*ncols")
127128

128129
self.ngrids = ngrids
129130

@@ -147,7 +148,7 @@ def __init__(self, fig,
147148
elif len(rect) == 4:
148149
self._divider = Divider(fig, rect, **kw)
149150
else:
150-
raise Exception("")
151+
raise TypeError("Incorrect rect format")
151152

152153
rect = self._divider.get_position()
153154

0 commit comments

Comments
 (0)
0