Repository: dask/dask

Issue:
ValueError exception when using da.stack() is too verbose.
I was attempting to stack 1-d arrays that were read in from a list of `hdf5` files and I blindly followed some boiler-plate [here (array-hdf5)](http://dask.pydata.org/en/latest/examples/array-hdf5.html#). I had ~10,000 arrays that I attempted to stack and the traceback was too verbose as it lists the size of each individual array that I was attempting to stack. 

It think the `Traceback` should  skip displaying the sizes of the individual arrays or handle them in a smarter way by return. Note that after _actually_ reading the [stack, concatenate, and block documentation](http://dask.pydata.org/en/latest/array-stack.html#) it was clear that I should be using `concatenate` and so it was really a user error on my part lol. 

Anyways, the problem still remains that the traceback is essentially unbounded. Plus, it's a simple fix as you only need to remove the  `"..Got %s", [x.shape for x in seq]"` portion of the `ValueError()` or maybe return only a list of the unique shapes tuples by doing `set([x.shape for x in seq])` or something along those lines.
 
MWE
``` python
import numpy as np
import dask.array as da

N=100
rand_size = np.random.randint(1e3,1e4,size=N) # N random array sizes
rand_arr = [np.random.rand(size) for size in rand_size] # N randomly sized arrays
da_rand_arr = [da.from_array(arr, chunks=1e2) for arr in rand_arr] # Convert them to dask arrays
x = da.stack(da_rand_arr, axis=0)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-1-1bc07fcfdcc1> in <module>()
      6 rand_arr = [np.random.rand(size) for size in rand_size] # N randomly sized arrays
      7 da_rand_arr = [da.from_array(arr, chunks=1e2) for arr in rand_arr] # Convert them to dask arrays
----> 8 x = da.stack(da_rand_arr, axis=0)

~/miniconda3/envs/astroconda3/lib/python3.6/site-packages/dask/array/core.py in stack(seq, axis)
   3637     if not all(x.shape == seq[0].shape for x in seq):
   3638         raise ValueError("Stacked arrays must have the same shape. Got %s",
-> 3639                          [x.shape for x in seq])
   3640 
   3641     ind = list(range(ndim))

ValueError: ('Stacked arrays must have the same shape. Got %s', [(3556,), (4444,), (3314,), (7310,), (9619,), (2346,), (3513,), (4840,), (7844,), (4226,), (5426,), (6735,), (9695,), (6998,), (9099,), (7529,), (3825,), (3720,), (8882,), (8107,), (2361,), (5933,), (7392,), (2839,), (8659,), (9984,), (5285,), (5445,), (8320,), (7674,), (8962,), (3500,), (7632,), (5624,), (3374,), (5849,), (1425,), (8344,), (1487,), (5457,), (6076,), (1608,), (1611,), (4152,), (3408,), (8743,), (5775,), (8244,), (1069,), (2922,), (9263,), (2802,), (6441,), (4198,), (3101,), (5776,), (2487,), (9003,), (2015,), (7582,), (5734,), (8715,), (8161,), (7697,), (7131,), (2417,), (4067,), (1188,), (1151,), (7045,), (5605,), (8532,), (5192,), (3520,), (2684,), (8015,), (2839,), (6987,), (5875,), (2619,), (5820,), (7123,), (9466,), (7467,), (6434,), (8581,), (6593,), (7352,), (5708,), (1217,), (8538,), (1286,), (8735,), (1031,), (8512,), (2643,), (3304,), (2847,), (2390,), (9384,)])

```


Discussion:
Rather than removing the information at all, maybe it's worthwhile printing the first size that failed? 
Yeah, I like the idea of returning the first size that fails. Returning a list of only the unique sizes still has the same problem in the event that all arrays have different sizes. 
Something like: "all shapes so far were {}, but at chunk {} found shape {}"

Resolving patch:
diff --git a/dask/array/core.py b/dask/array/core.py
--- a/dask/array/core.py
+++ b/dask/array/core.py
@@ -3785,8 +3785,13 @@ def stack(seq, axis=0):
                          "\nData has %d dimensions, but got axis=%d" %
                          (ndim, axis))
     if not all(x.shape == seq[0].shape for x in seq):
-        raise ValueError("Stacked arrays must have the same shape. Got %s",
-                         [x.shape for x in seq])
+        idx = np.where(np.asanyarray([x.shape for x in seq]) != seq[0].shape)[0]
+        raise ValueError("Stacked arrays must have the same shape. "
+                         "The first {0} had shape {1}, while array "
+                         "{2} has shape {3}".format(idx[0],
+                                                    seq[0].shape,
+                                                    idx[0] + 1,
+                                                    seq[idx[0]].shape))
 
     ind = list(range(ndim))
     uc_args = list(concat((x, ind) for x in seq))


Test patch:
diff --git a/dask/array/tests/test_array_core.py b/dask/array/tests/test_array_core.py
--- a/dask/array/tests/test_array_core.py
+++ b/dask/array/tests/test_array_core.py
@@ -3327,10 +3327,12 @@ def test_concatenate_errs():
 
 def test_stack_errs():
     with pytest.raises(ValueError) as e:
-        da.stack([da.zeros((2), chunks=(2)),
-                  da.zeros((3), chunks=(3))])
-    assert 'shape' in str(e).lower()
-    assert '(2,)' in str(e)
+        da.stack([da.zeros((2,), chunks=(2))] * 10 +
+                 [da.zeros((3,), chunks=(3))] * 10)
+
+    assert 'shape' in str(e.value).lower()
+    assert '(2,)' in str(e.value)
+    assert len(str(e.value)) < 105
 
 
 def test_atop_with_numpy_arrays():