dependency_collector: use ArgumentError exception.

Avoids errors with `brew versions` when bottling.

References #27615.