Repository: pandas-dev/pandas
File: pandas/core/construction.py (Python)

Code before:
        DatetimeArray,
        ExtensionArray,
        FloatingArray,
        IntegerArray,
        NumpyExtensionArray,
        TimedeltaArray,
    )
    from pandas.core.arrays.string_ import StringDtype

    if lib.is_scalar(data):
        msg = f"Cannot pass scalar '{data}' to 'pandas.array'."
        raise ValueError(msg)
    elif isinstance(data, ABCDataFrame):
        raise TypeError("Cannot pass DataFrame to 'pandas.array'")

    if dtype is None and isinstance(data, (ABCSeries, ABCIndex, ExtensionArray)):
        # Note: we exclude np.ndarray here, will do type inference on it
        dtype = data.dtype

    data = extract_array(data, extract_numpy=True)

    # Handle numpy masked arrays: convert masked values to NA
    # GH#63879
    if isinstance(data, ma.MaskedArray):
        if data.dtype.names is not None:
            raise TypeError(
                "Structured masked arrays are not supported. "
                "Use a 1-D masked array instead."
            )
        elif data.mask is not np.False_ and ma.getmaskarray(data).any():
            na_dtype = ensure_dtype_can_hold_na(data.dtype)
            if na_dtype.char in "SU":
                na_dtype = np.dtype("object")
            data = cast(ma.MaskedArray, data.astype(na_dtype)).filled(np.nan)
        else:
            # No mask, convert to regular array
            data = np.asarray(data)

    # this returns None for not-found dtypes.
    if dtype is not None:
        dtype = pandas_dtype(dtype)

    if isinstance(data, ExtensionArray) and (dtype is None or data.dtype == dtype):
        # e.g. TimedeltaArray[s], avoid casting to NumpyExtensionArray
        if copy:
            return data.copy()
        return data

    if isinstance(dtype, ExtensionDtype):
        cls = dtype.construct_array_type()
        return cls._from_sequence(data, dtype=dtype, copy=copy)

Review comment (suggestion):
The `type` (in the Python sense) is `ndarray`. Some values of this type will raise, and some values will not. Thus this should be a `ValueError` as Series raises currently.

Can you also match the Series message:

> Cannot construct an array from an ndarray with compound dtype.  Use DataFrame instead.

Code after:
        DatetimeArray,
        ExtensionArray,
        FloatingArray,
        IntegerArray,
        NumpyExtensionArray,
        TimedeltaArray,
    )
    from pandas.core.arrays.string_ import StringDtype

    if lib.is_scalar(data):
        msg = f"Cannot pass scalar '{data}' to 'pandas.array'."
        raise ValueError(msg)
    elif isinstance(data, ABCDataFrame):
        raise TypeError("Cannot pass DataFrame to 'pandas.array'")

    if dtype is None and isinstance(data, (ABCSeries, ABCIndex, ExtensionArray)):
        # Note: we exclude np.ndarray here, will do type inference on it
        dtype = data.dtype

    data = extract_array(data, extract_numpy=True)

    # Handle numpy masked arrays: convert masked values to NA
    # GH#63879
    if isinstance(data, ma.MaskedArray):
        if data.dtype.names is not None:
            raise ValueError(
                "Cannot construct an array from an ndarray with compound dtype. "
                "Use DataFrame instead."
            )
        elif data.mask is not np.False_ and ma.getmaskarray(data).any():
            na_dtype = ensure_dtype_can_hold_na(data.dtype)
            if na_dtype.char in "SU":
                na_dtype = np.dtype("object")
            data = cast(ma.MaskedArray, data.astype(na_dtype)).filled(np.nan)
        else:
            # No mask, convert to regular array
            data = np.asarray(data)

    # this returns None for not-found dtypes.
    if dtype is not None:
        dtype = pandas_dtype(dtype)

    if isinstance(data, ExtensionArray) and (dtype is None or data.dtype == dtype):
        # e.g. TimedeltaArray[s], avoid casting to NumpyExtensionArray
        if copy:
            return data.copy()
        return data

    if isinstance(dtype, ExtensionDtype):
        cls = dtype.construct_array_type()
        return cls._from_sequence(data, dtype=dtype, copy=copy)