User analytics: replace error prints with exceptions

Raising exceptions is more robust and verbose than printing something
before one silently returns. Additionally, a RuntimeError has been
replaced by a ValueError. The latter seems to be more fitting here.

This relates to issue #596.