@@ -338,7 +338,8 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
338338
339339 if not unsampled :
340340 if A .ndim not in (2 , 3 ):
341- raise ValueError ("Invalid dimensions, got {}" .format (A .shape ))
341+ raise ValueError ("Invalid shape {} for image data"
342+ .format (A .shape ))
342343
343344 if A .ndim == 2 :
344345 # if we are a 2D array, then we are running through the
@@ -482,7 +483,8 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
482483 if A .shape [2 ] == 3 :
483484 A = _rgb_to_rgba (A )
484485 elif A .shape [2 ] != 4 :
485- raise ValueError ("Invalid dimensions, got %s" % (A .shape ,))
486+ raise ValueError ("Invalid shape {} for image data"
487+ .format (A .shape ))
486488
487489 output = np .zeros ((out_height , out_width , 4 ), dtype = A .dtype )
488490
@@ -638,11 +640,13 @@ def set_data(self, A):
638640
639641 if (self ._A .dtype != np .uint8 and
640642 not np .can_cast (self ._A .dtype , float , "same_kind" )):
641- raise TypeError ("Image data cannot be converted to float" )
643+ raise TypeError ("Image data of dtype {} cannot be converted to "
644+ "float" .format (self ._A .dtype ))
642645
643646 if not (self ._A .ndim == 2
644647 or self ._A .ndim == 3 and self ._A .shape [- 1 ] in [3 , 4 ]):
645- raise TypeError ("Invalid dimensions for image data" )
648+ raise TypeError ("Invalid shape {} for image data"
649+ .format (self ._A .shape ))
646650
647651 if self ._A .ndim == 3 :
648652 # If the input data has values outside the valid range (after
0 commit comments