use get_scalar_constant_value for ndim == 0 again; add error message to TypeError exception