Raise ``ValueError`` for ``gen_string`` function.

If an invalid string type is requested from ``gen_string``, raise
``ValueError`` instead of a generic ``Exception``. Fixes issue #30.