Improved error message for bad input array shapes