can we replace the ``assert`` with a specific exception?