Improve error handling
This commit is contained in:
parent
934bfcd74e
commit
3d52566016
1 changed files with 1 additions and 1 deletions
|
|
@ -31,7 +31,7 @@ class Polygon(Shape):
|
|||
@vertices.setter
|
||||
def vertices(self, val: numpy.ndarray):
|
||||
val = numpy.array(val, dtype=float)
|
||||
if val.shape[1] != 2:
|
||||
if len(val.shape) < 2 or val.shape[1] != 2:
|
||||
raise PatternError('Vertices must be an Nx2 array')
|
||||
if val.shape[0] < 3:
|
||||
raise PatternError('Must have at least 3 vertices (Nx2, N>3)')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue