This should be a ``TypeError``.

Also since I see this pattern a few places, might be nice to wrap it up into a utility function, might be OK to stick it in ``warehouse.db``.